diff mbox series

[RFC,v4,net-next,12/17] mfd: ocelot: add shared resource names for switch functionality

Message ID 20221008185152.2411007-13-colin.foster@in-advantage.com (mailing list archive)
State RFC
Delegated to: Netdev Maintainers
Headers show
Series add support for the the vsc7512 internal copper phys | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next, async
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count fail Series longer than 15 patches (and no cover letter)
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 2 of 2 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 15 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Colin Foster Oct. 8, 2022, 6:51 p.m. UTC
The switch portion of the Ocelot chip relies on several resources. Define
the resource names here, so they can be referenced by both the switch
driver and the MFD.

Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
---

v4
    * New patch. Previous versions had entire structures shared,
      this only requires that the names be shared.

---
 include/linux/mfd/ocelot.h | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Lee Jones Oct. 31, 2022, 9:35 a.m. UTC | #1
On Sat, 08 Oct 2022, Colin Foster wrote:

> The switch portion of the Ocelot chip relies on several resources. Define
> the resource names here, so they can be referenced by both the switch
> driver and the MFD.
> 
> Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
> ---
> 
> v4
>     * New patch. Previous versions had entire structures shared,
>       this only requires that the names be shared.
> 
> ---
>  include/linux/mfd/ocelot.h | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/include/linux/mfd/ocelot.h b/include/linux/mfd/ocelot.h
> index dd72073d2d4f..b80f2f5ff1d6 100644
> --- a/include/linux/mfd/ocelot.h
> +++ b/include/linux/mfd/ocelot.h
> @@ -13,6 +13,15 @@
>  
>  struct resource;
>  
> +#define OCELOT_RES_NAME_ANA	"ana"
> +#define OCELOT_RES_NAME_QS	"qs"
> +#define OCELOT_RES_NAME_QSYS	"qsys"
> +#define OCELOT_RES_NAME_REW	"rew"
> +#define OCELOT_RES_NAME_SYS	"sys"
> +#define OCELOT_RES_NAME_S0	"s0"
> +#define OCELOT_RES_NAME_S1	"s1"
> +#define OCELOT_RES_NAME_S2	"s2"

I've never been a fan of defining name strings.

The end of the define name is identical to the resource names.

This also makes grepping that much harder for little gain.
Colin Foster Nov. 1, 2022, 2:39 a.m. UTC | #2
Hi Lee,

On Mon, Oct 31, 2022 at 09:35:01AM +0000, Lee Jones wrote:
> On Sat, 08 Oct 2022, Colin Foster wrote:
> 
> > The switch portion of the Ocelot chip relies on several resources. Define
> > the resource names here, so they can be referenced by both the switch
> > driver and the MFD.
> > 
> > Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
> > ---
> > 
> > v4
> >     * New patch. Previous versions had entire structures shared,
> >       this only requires that the names be shared.
> > 
> > ---
> >  include/linux/mfd/ocelot.h | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> > 
> > diff --git a/include/linux/mfd/ocelot.h b/include/linux/mfd/ocelot.h
> > index dd72073d2d4f..b80f2f5ff1d6 100644
> > --- a/include/linux/mfd/ocelot.h
> > +++ b/include/linux/mfd/ocelot.h
> > @@ -13,6 +13,15 @@
> >  
> >  struct resource;
> >  
> > +#define OCELOT_RES_NAME_ANA	"ana"
> > +#define OCELOT_RES_NAME_QS	"qs"
> > +#define OCELOT_RES_NAME_QSYS	"qsys"
> > +#define OCELOT_RES_NAME_REW	"rew"
> > +#define OCELOT_RES_NAME_SYS	"sys"
> > +#define OCELOT_RES_NAME_S0	"s0"
> > +#define OCELOT_RES_NAME_S1	"s1"
> > +#define OCELOT_RES_NAME_S2	"s2"
> 
> I've never been a fan of defining name strings.
> 
> The end of the define name is identical to the resource names.
> 
> This also makes grepping that much harder for little gain.

I defined them here because they'll be directly used in multiple files.
In this case, drivers/net/dsa/ocelot/ocelot_ext.c uses all these defines
as well as drivers/mfd/ocelot-core.c. Future patch sets will also
utilize other resource names by string as well...

But I'll plan to drop this patch next round unless someone disagrees.

Thanks for the feedback!

> 
> -- 
> Lee Jones [李琼斯]
diff mbox series

Patch

diff --git a/include/linux/mfd/ocelot.h b/include/linux/mfd/ocelot.h
index dd72073d2d4f..b80f2f5ff1d6 100644
--- a/include/linux/mfd/ocelot.h
+++ b/include/linux/mfd/ocelot.h
@@ -13,6 +13,15 @@ 
 
 struct resource;
 
+#define OCELOT_RES_NAME_ANA	"ana"
+#define OCELOT_RES_NAME_QS	"qs"
+#define OCELOT_RES_NAME_QSYS	"qsys"
+#define OCELOT_RES_NAME_REW	"rew"
+#define OCELOT_RES_NAME_SYS	"sys"
+#define OCELOT_RES_NAME_S0	"s0"
+#define OCELOT_RES_NAME_S1	"s1"
+#define OCELOT_RES_NAME_S2	"s2"
+
 static inline struct regmap *
 ocelot_regmap_from_resource_optional(struct platform_device *pdev,
 				     unsigned int index,