diff mbox series

[4/7] spl: fit: Warn if FIT contains "fpga" property in config node

Message ID 20210310180442.746517-5-mr.nuke.me@gmail.com
State Superseded
Delegated to: Tom Rini
Headers show
Series SPL: FIT: Bring the SPL_LOAD_FIT path in line with documentation | expand

Commit Message

Alex G. March 10, 2021, 6:04 p.m. UTC
Commit 4afc4f37c70e ("doc: FIT image: Clarify format and simplify
syntax") requires that FPGA images be referenced through the
"loadables" in the config node. This means that "fpga" properties in
config nodes are deprecated.

Given that there are likely FIT images which use "fpga", let's not
break those right away. Print a warning message that such use is
deprecated, and give users a couple of releases to update their

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
---
 common/spl/spl_fit.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Simon Glass March 18, 2021, 6:44 a.m. UTC | #1
Hi Alexandru,

On Thu, 11 Mar 2021 at 07:04, Alexandru Gagniuc <mr.nuke.me@gmail.com> wrote:
>
> Commit 4afc4f37c70e ("doc: FIT image: Clarify format and simplify
> syntax") requires that FPGA images be referenced through the
> "loadables" in the config node. This means that "fpga" properties in
> config nodes are deprecated.
>
> Given that there are likely FIT images which use "fpga", let's not
> break those right away. Print a warning message that such use is
> deprecated, and give users a couple of releases to update their
>
> Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
> ---
>  common/spl/spl_fit.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
> index 55fca9f399..68f29c0026 100644
> --- a/common/spl/spl_fit.c
> +++ b/common/spl/spl_fit.c
> @@ -526,6 +526,13 @@ __weak bool spl_load_simple_fit_skip_processing(void)
>         return false;
>  }
>
> +static void warn_deprecated(const char *msg)
> +{
> +       printf("DEPRECATED: %s\n", msg);
> +       printf("\tThis will stop working in a future u-boot release\n");
> +       printf("\tSee doc/uImage.FIT/source_file_format.txt\n");

That is a lot of text to add...can it be shorter?

> +}
> +
>  static int spl_fit_upload_fpga(struct spl_fit_info *ctx, int node,
>                                struct spl_image_info *fpga_image)
>  {
> @@ -558,6 +565,8 @@ static int spl_fit_load_fpga(struct spl_fit_info *ctx,
>         if (node < 0)
>                 return node;
>
> +       warn_deprecated("'fpga' property in config node. Use 'loadables'");
> +
>         /* Load the image and set up the fpga_image structure */
>         ret = spl_load_fit_image(info, sector, ctx, node, &fpga_image);
>         if (ret) {
> --
> 2.26.2
>

Regards,
Simon
Alex G. March 19, 2021, 2:53 p.m. UTC | #2
On 3/18/21 1:44 AM, Simon Glass wrote:
> Hi Alexandru,
> 
> On Thu, 11 Mar 2021 at 07:04, Alexandru Gagniuc <mr.nuke.me@gmail.com> wrote:
>>
>> Commit 4afc4f37c70e ("doc: FIT image: Clarify format and simplify
>> syntax") requires that FPGA images be referenced through the
>> "loadables" in the config node. This means that "fpga" properties in
>> config nodes are deprecated.
>>
>> Given that there are likely FIT images which use "fpga", let's not
>> break those right away. Print a warning message that such use is
>> deprecated, and give users a couple of releases to update their
>>
>> Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
>> ---
>>   common/spl/spl_fit.c | 9 +++++++++
>>   1 file changed, 9 insertions(+)
>>
>> diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
>> index 55fca9f399..68f29c0026 100644
>> --- a/common/spl/spl_fit.c
>> +++ b/common/spl/spl_fit.c
>> @@ -526,6 +526,13 @@ __weak bool spl_load_simple_fit_skip_processing(void)
>>          return false;
>>   }
>>
>> +static void warn_deprecated(const char *msg)
>> +{
>> +       printf("DEPRECATED: %s\n", msg);
>> +       printf("\tThis will stop working in a future u-boot release\n");
>> +       printf("\tSee doc/uImage.FIT/source_file_format.txt\n");
> 
> That is a lot of text to add...can it be shorter?

Sure. The idea was that we'd remove this message in a couple of releases 
anyway, and we want it very loud until then. If I remove the middle 
printf(), will thgat work ?

Alex

>> +}
>> +
>>   static int spl_fit_upload_fpga(struct spl_fit_info *ctx, int node,
>>                                 struct spl_image_info *fpga_image)
>>   {
>> @@ -558,6 +565,8 @@ static int spl_fit_load_fpga(struct spl_fit_info *ctx,
>>          if (node < 0)
>>                  return node;
>>
>> +       warn_deprecated("'fpga' property in config node. Use 'loadables'");
>> +
>>          /* Load the image and set up the fpga_image structure */
>>          ret = spl_load_fit_image(info, sector, ctx, node, &fpga_image);
>>          if (ret) {
>> --
>> 2.26.2
>>
> 
> Regards,
> Simon
>
Simon Glass March 19, 2021, 11:54 p.m. UTC | #3
Hi Alex,

On Sat, 20 Mar 2021 at 03:53, Alex G. <mr.nuke.me@gmail.com> wrote:
>
>
>
> On 3/18/21 1:44 AM, Simon Glass wrote:
> > Hi Alexandru,
> >
> > On Thu, 11 Mar 2021 at 07:04, Alexandru Gagniuc <mr.nuke.me@gmail.com> wrote:
> >>
> >> Commit 4afc4f37c70e ("doc: FIT image: Clarify format and simplify
> >> syntax") requires that FPGA images be referenced through the
> >> "loadables" in the config node. This means that "fpga" properties in
> >> config nodes are deprecated.
> >>
> >> Given that there are likely FIT images which use "fpga", let's not
> >> break those right away. Print a warning message that such use is
> >> deprecated, and give users a couple of releases to update their
> >>
> >> Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
> >> ---
> >>   common/spl/spl_fit.c | 9 +++++++++
> >>   1 file changed, 9 insertions(+)
> >>
> >> diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
> >> index 55fca9f399..68f29c0026 100644
> >> --- a/common/spl/spl_fit.c
> >> +++ b/common/spl/spl_fit.c
> >> @@ -526,6 +526,13 @@ __weak bool spl_load_simple_fit_skip_processing(void)
> >>          return false;
> >>   }
> >>
> >> +static void warn_deprecated(const char *msg)
> >> +{
> >> +       printf("DEPRECATED: %s\n", msg);
> >> +       printf("\tThis will stop working in a future u-boot release\n");
> >> +       printf("\tSee doc/uImage.FIT/source_file_format.txt\n");
> >
> > That is a lot of text to add...can it be shorter?
>
> Sure. The idea was that we'd remove this message in a couple of releases
> anyway, and we want it very loud until then. If I remove the middle
> printf(), will thgat work ?

Sounds good, people can always look at the code for a message.

Regards,
Simon
diff mbox series

Patch

diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
index 55fca9f399..68f29c0026 100644
--- a/common/spl/spl_fit.c
+++ b/common/spl/spl_fit.c
@@ -526,6 +526,13 @@  __weak bool spl_load_simple_fit_skip_processing(void)
 	return false;
 }
 
+static void warn_deprecated(const char *msg)
+{
+	printf("DEPRECATED: %s\n", msg);
+	printf("\tThis will stop working in a future u-boot release\n");
+	printf("\tSee doc/uImage.FIT/source_file_format.txt\n");
+}
+
 static int spl_fit_upload_fpga(struct spl_fit_info *ctx, int node,
 			       struct spl_image_info *fpga_image)
 {
@@ -558,6 +565,8 @@  static int spl_fit_load_fpga(struct spl_fit_info *ctx,
 	if (node < 0)
 		return node;
 
+	warn_deprecated("'fpga' property in config node. Use 'loadables'");
+
 	/* Load the image and set up the fpga_image structure */
 	ret = spl_load_fit_image(info, sector, ctx, node, &fpga_image);
 	if (ret) {