mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] ARM: at91: remove unused soc type/subtype getter functions
@ 2025-06-19 10:34 Alexander Shiyan
  2025-06-19 17:13 ` Sam Ravnborg
  2025-06-20 11:59 ` Sascha Hauer
  0 siblings, 2 replies; 5+ messages in thread
From: Alexander Shiyan @ 2025-06-19 10:34 UTC (permalink / raw)
  To: barebox; +Cc: Alexander Shiyan

The functions at91_get_soc_type() and at91_get_soc_subtype() were
used only within the setup.c file. They provided simple access to
string arrays but added an unnecessary layer of abstraction.
Since they are not used elsewhere, we can safely remove them and
access the string arrays directly.

Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com>
---
 arch/arm/mach-at91/setup.c | 22 ++++++----------------
 include/mach/at91/cpu.h    |  2 --
 2 files changed, 6 insertions(+), 18 deletions(-)

diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
index e726495726..5969c32e54 100644
--- a/arch/arm/mach-at91/setup.c
+++ b/arch/arm/mach-at91/setup.c
@@ -281,12 +281,6 @@ static const char *soc_name[] = {
 	[AT91_SOC_NONE]		= "Unknown"
 };
 
-const char *at91_get_soc_type(struct at91_socinfo *c)
-{
-	return soc_name[c->type];
-}
-EXPORT_SYMBOL(at91_get_soc_type);
-
 static const char *soc_subtype_name[] = {
 	[AT91_SOC_RM9200_BGA]	= "at91rm9200 BGA",
 	[AT91_SOC_RM9200_PQFP]	= "at91rm9200 PQFP",
@@ -330,12 +324,6 @@ static const char *soc_subtype_name[] = {
 	[AT91_SOC_SUBTYPE_NONE]	= "Unknown"
 };
 
-const char *at91_get_soc_subtype(struct at91_socinfo *c)
-{
-	return soc_subtype_name[c->subtype];
-}
-EXPORT_SYMBOL(at91_get_soc_subtype);
-
 static int at91_detect(void)
 {
 	at91_soc_initdata.type = AT91_SOC_NONE;
@@ -353,9 +341,9 @@ static int at91_detect(void)
 		panic("AT91: Impossible to detect the SOC type");
 
 	pr_info("AT91: Detected soc type: %s\n",
-		at91_get_soc_type(&at91_soc_initdata));
+		soc_name[at91_soc_initdata.type]);
 	pr_info("AT91: Detected soc subtype: %s\n",
-		at91_get_soc_subtype(&at91_soc_initdata));
+		soc_subtype_name[at91_soc_initdata.subtype]);
 
 	/* Init clock subsystem */
 	at91_clock_init();
@@ -372,8 +360,10 @@ static int at91_soc_device(void)
 	struct device *dev;
 
 	dev = add_generic_device_res("soc", DEVICE_ID_SINGLE, NULL, 0, NULL);
-	dev_add_param_fixed(dev, "name", (char*)at91_get_soc_type(&at91_soc_initdata));
-	dev_add_param_fixed(dev, "subname", (char*)at91_get_soc_subtype(&at91_soc_initdata));
+	dev_add_param_fixed(dev, "name",
+			    (char*)soc_name[at91_soc_initdata.type]);
+	dev_add_param_fixed(dev, "subname",
+			    (char*)soc_subtype_name[at91_soc_initdata.subtype]);
 
 	return 0;
 }
diff --git a/include/mach/at91/cpu.h b/include/mach/at91/cpu.h
index ca85e8be6e..7114b5d63f 100644
--- a/include/mach/at91/cpu.h
+++ b/include/mach/at91/cpu.h
@@ -158,8 +158,6 @@ struct at91_socinfo {
 };
 
 extern struct at91_socinfo at91_soc_initdata;
-const char *at91_get_soc_type(struct at91_socinfo *c);
-const char *at91_get_soc_subtype(struct at91_socinfo *c);
 
 static inline int at91_soc_is_detected(void)
 {
-- 
2.39.1




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ARM: at91: remove unused soc type/subtype getter functions
  2025-06-19 10:34 [PATCH] ARM: at91: remove unused soc type/subtype getter functions Alexander Shiyan
@ 2025-06-19 17:13 ` Sam Ravnborg
  2025-06-20  5:48   ` Alexander Shiyan
  2025-06-20 11:59 ` Sascha Hauer
  1 sibling, 1 reply; 5+ messages in thread
From: Sam Ravnborg @ 2025-06-19 17:13 UTC (permalink / raw)
  To: Alexander Shiyan; +Cc: barebox

Hi Alexander.

On Thu, Jun 19, 2025 at 01:34:40PM +0300, Alexander Shiyan wrote:
> The functions at91_get_soc_type() and at91_get_soc_subtype() were
> used only within the setup.c file. They provided simple access to
> string arrays but added an unnecessary layer of abstraction.
> Since they are not used elsewhere, we can safely remove them and
> access the string arrays directly.
> 
> Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com>
> ---
>  arch/arm/mach-at91/setup.c | 22 ++++++----------------
>  include/mach/at91/cpu.h    |  2 --
>  2 files changed, 6 insertions(+), 18 deletions(-)
> 
> diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
> index e726495726..5969c32e54 100644
> --- a/arch/arm/mach-at91/setup.c
> +++ b/arch/arm/mach-at91/setup.c
> @@ -281,12 +281,6 @@ static const char *soc_name[] = {
>  	[AT91_SOC_NONE]		= "Unknown"
>  };
>  
> -const char *at91_get_soc_type(struct at91_socinfo *c)
> -{
> -	return soc_name[c->type];
> -}
> -EXPORT_SYMBOL(at91_get_soc_type);
> -
>  static const char *soc_subtype_name[] = {
>  	[AT91_SOC_RM9200_BGA]	= "at91rm9200 BGA",
>  	[AT91_SOC_RM9200_PQFP]	= "at91rm9200 PQFP",
> @@ -330,12 +324,6 @@ static const char *soc_subtype_name[] = {
>  	[AT91_SOC_SUBTYPE_NONE]	= "Unknown"
>  };
>  
> -const char *at91_get_soc_subtype(struct at91_socinfo *c)
> -{
> -	return soc_subtype_name[c->subtype];
> -}
> -EXPORT_SYMBOL(at91_get_soc_subtype);
> -
>  static int at91_detect(void)
>  {
>  	at91_soc_initdata.type = AT91_SOC_NONE;
> @@ -353,9 +341,9 @@ static int at91_detect(void)
>  		panic("AT91: Impossible to detect the SOC type");
>  
>  	pr_info("AT91: Detected soc type: %s\n",
> -		at91_get_soc_type(&at91_soc_initdata));
> +		soc_name[at91_soc_initdata.type]);
>  	pr_info("AT91: Detected soc subtype: %s\n",
> -		at91_get_soc_subtype(&at91_soc_initdata));
> +		soc_subtype_name[at91_soc_initdata.subtype]);
>  
>  	/* Init clock subsystem */
>  	at91_clock_init();
> @@ -372,8 +360,10 @@ static int at91_soc_device(void)
>  	struct device *dev;
>  
>  	dev = add_generic_device_res("soc", DEVICE_ID_SINGLE, NULL, 0, NULL);
> -	dev_add_param_fixed(dev, "name", (char*)at91_get_soc_type(&at91_soc_initdata));
> -	dev_add_param_fixed(dev, "subname", (char*)at91_get_soc_subtype(&at91_soc_initdata));
> +	dev_add_param_fixed(dev, "name",
> +			    (char*)soc_name[at91_soc_initdata.type]);
> +	dev_add_param_fixed(dev, "subname",
> +			    (char*)soc_subtype_name[at91_soc_initdata.subtype]);
The cast can go, as dev_add_param_fixed() take a const already.
Otherwise looks good.
It is good to see at91 gets some attention, despite the age.

	Sam



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ARM: at91: remove unused soc type/subtype getter functions
  2025-06-19 17:13 ` Sam Ravnborg
@ 2025-06-20  5:48   ` Alexander Shiyan
  2025-06-20 11:59     ` Sascha Hauer
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Shiyan @ 2025-06-20  5:48 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: barebox

Hello.

Indeed, I hope Sasсha can fix this in the commit.

Thanks!

чт, 19 июн. 2025 г. в 20:14, Sam Ravnborg <sam@ravnborg.org>:
>
> Hi Alexander.
>
> On Thu, Jun 19, 2025 at 01:34:40PM +0300, Alexander Shiyan wrote:
> > The functions at91_get_soc_type() and at91_get_soc_subtype() were
> > used only within the setup.c file. They provided simple access to
> > string arrays but added an unnecessary layer of abstraction.
> > Since they are not used elsewhere, we can safely remove them and
> > access the string arrays directly.
> >
> > Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com>
> > ---
> >  arch/arm/mach-at91/setup.c | 22 ++++++----------------
> >  include/mach/at91/cpu.h    |  2 --
> >  2 files changed, 6 insertions(+), 18 deletions(-)
> >
> > diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
> > index e726495726..5969c32e54 100644
> > --- a/arch/arm/mach-at91/setup.c
> > +++ b/arch/arm/mach-at91/setup.c
> > @@ -281,12 +281,6 @@ static const char *soc_name[] = {
> >       [AT91_SOC_NONE]         = "Unknown"
> >  };
> >
> > -const char *at91_get_soc_type(struct at91_socinfo *c)
> > -{
> > -     return soc_name[c->type];
> > -}
> > -EXPORT_SYMBOL(at91_get_soc_type);
> > -
> >  static const char *soc_subtype_name[] = {
> >       [AT91_SOC_RM9200_BGA]   = "at91rm9200 BGA",
> >       [AT91_SOC_RM9200_PQFP]  = "at91rm9200 PQFP",
> > @@ -330,12 +324,6 @@ static const char *soc_subtype_name[] = {
> >       [AT91_SOC_SUBTYPE_NONE] = "Unknown"
> >  };
> >
> > -const char *at91_get_soc_subtype(struct at91_socinfo *c)
> > -{
> > -     return soc_subtype_name[c->subtype];
> > -}
> > -EXPORT_SYMBOL(at91_get_soc_subtype);
> > -
> >  static int at91_detect(void)
> >  {
> >       at91_soc_initdata.type = AT91_SOC_NONE;
> > @@ -353,9 +341,9 @@ static int at91_detect(void)
> >               panic("AT91: Impossible to detect the SOC type");
> >
> >       pr_info("AT91: Detected soc type: %s\n",
> > -             at91_get_soc_type(&at91_soc_initdata));
> > +             soc_name[at91_soc_initdata.type]);
> >       pr_info("AT91: Detected soc subtype: %s\n",
> > -             at91_get_soc_subtype(&at91_soc_initdata));
> > +             soc_subtype_name[at91_soc_initdata.subtype]);
> >
> >       /* Init clock subsystem */
> >       at91_clock_init();
> > @@ -372,8 +360,10 @@ static int at91_soc_device(void)
> >       struct device *dev;
> >
> >       dev = add_generic_device_res("soc", DEVICE_ID_SINGLE, NULL, 0, NULL);
> > -     dev_add_param_fixed(dev, "name", (char*)at91_get_soc_type(&at91_soc_initdata));
> > -     dev_add_param_fixed(dev, "subname", (char*)at91_get_soc_subtype(&at91_soc_initdata));
> > +     dev_add_param_fixed(dev, "name",
> > +                         (char*)soc_name[at91_soc_initdata.type]);
> > +     dev_add_param_fixed(dev, "subname",
> > +                         (char*)soc_subtype_name[at91_soc_initdata.subtype]);
> The cast can go, as dev_add_param_fixed() take a const already.
> Otherwise looks good.
> It is good to see at91 gets some attention, despite the age.
>
>         Sam



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ARM: at91: remove unused soc type/subtype getter functions
  2025-06-19 10:34 [PATCH] ARM: at91: remove unused soc type/subtype getter functions Alexander Shiyan
  2025-06-19 17:13 ` Sam Ravnborg
@ 2025-06-20 11:59 ` Sascha Hauer
  1 sibling, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2025-06-20 11:59 UTC (permalink / raw)
  To: barebox, Alexander Shiyan


On Thu, 19 Jun 2025 13:34:40 +0300, Alexander Shiyan wrote:
> The functions at91_get_soc_type() and at91_get_soc_subtype() were
> used only within the setup.c file. They provided simple access to
> string arrays but added an unnecessary layer of abstraction.
> Since they are not used elsewhere, we can safely remove them and
> access the string arrays directly.
> 
> 
> [...]

Applied, thanks!

[1/1] ARM: at91: remove unused soc type/subtype getter functions
      https://git.pengutronix.de/cgit/barebox/commit/?id=a2a4de0237bc (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ARM: at91: remove unused soc type/subtype getter functions
  2025-06-20  5:48   ` Alexander Shiyan
@ 2025-06-20 11:59     ` Sascha Hauer
  0 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2025-06-20 11:59 UTC (permalink / raw)
  To: Alexander Shiyan; +Cc: Sam Ravnborg, barebox

On Fri, Jun 20, 2025 at 08:48:12AM +0300, Alexander Shiyan wrote:
> Hello.
> 
> Indeed, I hope Sasсha can fix this in the commit.

Did that.

Sascha

> 
> Thanks!
> 
> чт, 19 июн. 2025 г. в 20:14, Sam Ravnborg <sam@ravnborg.org>:
> >
> > Hi Alexander.
> >
> > On Thu, Jun 19, 2025 at 01:34:40PM +0300, Alexander Shiyan wrote:
> > > The functions at91_get_soc_type() and at91_get_soc_subtype() were
> > > used only within the setup.c file. They provided simple access to
> > > string arrays but added an unnecessary layer of abstraction.
> > > Since they are not used elsewhere, we can safely remove them and
> > > access the string arrays directly.
> > >
> > > Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com>
> > > ---
> > >  arch/arm/mach-at91/setup.c | 22 ++++++----------------
> > >  include/mach/at91/cpu.h    |  2 --
> > >  2 files changed, 6 insertions(+), 18 deletions(-)
> > >
> > > diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
> > > index e726495726..5969c32e54 100644
> > > --- a/arch/arm/mach-at91/setup.c
> > > +++ b/arch/arm/mach-at91/setup.c
> > > @@ -281,12 +281,6 @@ static const char *soc_name[] = {
> > >       [AT91_SOC_NONE]         = "Unknown"
> > >  };
> > >
> > > -const char *at91_get_soc_type(struct at91_socinfo *c)
> > > -{
> > > -     return soc_name[c->type];
> > > -}
> > > -EXPORT_SYMBOL(at91_get_soc_type);
> > > -
> > >  static const char *soc_subtype_name[] = {
> > >       [AT91_SOC_RM9200_BGA]   = "at91rm9200 BGA",
> > >       [AT91_SOC_RM9200_PQFP]  = "at91rm9200 PQFP",
> > > @@ -330,12 +324,6 @@ static const char *soc_subtype_name[] = {
> > >       [AT91_SOC_SUBTYPE_NONE] = "Unknown"
> > >  };
> > >
> > > -const char *at91_get_soc_subtype(struct at91_socinfo *c)
> > > -{
> > > -     return soc_subtype_name[c->subtype];
> > > -}
> > > -EXPORT_SYMBOL(at91_get_soc_subtype);
> > > -
> > >  static int at91_detect(void)
> > >  {
> > >       at91_soc_initdata.type = AT91_SOC_NONE;
> > > @@ -353,9 +341,9 @@ static int at91_detect(void)
> > >               panic("AT91: Impossible to detect the SOC type");
> > >
> > >       pr_info("AT91: Detected soc type: %s\n",
> > > -             at91_get_soc_type(&at91_soc_initdata));
> > > +             soc_name[at91_soc_initdata.type]);
> > >       pr_info("AT91: Detected soc subtype: %s\n",
> > > -             at91_get_soc_subtype(&at91_soc_initdata));
> > > +             soc_subtype_name[at91_soc_initdata.subtype]);
> > >
> > >       /* Init clock subsystem */
> > >       at91_clock_init();
> > > @@ -372,8 +360,10 @@ static int at91_soc_device(void)
> > >       struct device *dev;
> > >
> > >       dev = add_generic_device_res("soc", DEVICE_ID_SINGLE, NULL, 0, NULL);
> > > -     dev_add_param_fixed(dev, "name", (char*)at91_get_soc_type(&at91_soc_initdata));
> > > -     dev_add_param_fixed(dev, "subname", (char*)at91_get_soc_subtype(&at91_soc_initdata));
> > > +     dev_add_param_fixed(dev, "name",
> > > +                         (char*)soc_name[at91_soc_initdata.type]);
> > > +     dev_add_param_fixed(dev, "subname",
> > > +                         (char*)soc_subtype_name[at91_soc_initdata.subtype]);
> > The cast can go, as dev_add_param_fixed() take a const already.
> > Otherwise looks good.
> > It is good to see at91 gets some attention, despite the age.
> >
> >         Sam
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-06-20 12:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-19 10:34 [PATCH] ARM: at91: remove unused soc type/subtype getter functions Alexander Shiyan
2025-06-19 17:13 ` Sam Ravnborg
2025-06-20  5:48   ` Alexander Shiyan
2025-06-20 11:59     ` Sascha Hauer
2025-06-20 11:59 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox