Message ID | 20220329014537.4180966-1-liu.yun@linux.dev (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | MIPS: rb532: move GPIOD definition into C-files | expand |
On Tue, Mar 29, 2022 at 4:46 AM Jackie Liu <liu.yun@linux.dev> wrote: > > From: Jackie Liu <liuyun01@kylinos.cn> > > My kernel robot report build error from drivers/iio/adc/da9150-gpadc.c, > > We define GPIOD in rb.h, in fact he should only be used in gpio.c, but he --> it > it affects the driver da9150-gpadc.c which goes against the original > intention of the design, just move it to his scope. > At the same time, GPIONMIEN and IMASK6 are not used anywhere, just delete > them. While not being used it's good to leave (save) them since it might be the only means of the HW documentation. I know that Git history will keep that, but it is more explicit just to have them in the code. ... > #define DEV3TC 0x01003C > #define BTCS 0x010040 > #define BTCOMPARE 0x010044 > -#define GPIOBASE 0x050000 ... > +#define GPIOBASE 0x050000 I think this one belongs to the header.
在 2022/3/29 下午8:54, Andy Shevchenko 写道: > On Tue, Mar 29, 2022 at 4:46 AM Jackie Liu <liu.yun@linux.dev> wrote: >> >> From: Jackie Liu <liuyun01@kylinos.cn> >> >> My kernel robot report build error from drivers/iio/adc/da9150-gpadc.c, >> >> We define GPIOD in rb.h, in fact he should only be used in gpio.c, but > > he --> it > >> it affects the driver da9150-gpadc.c which goes against the original >> intention of the design, just move it to his scope. > >> At the same time, GPIONMIEN and IMASK6 are not used anywhere, just delete >> them. > > While not being used it's good to leave (save) them since it might be > the only means of the HW documentation. I know that Git history will > keep that, but it is more explicit just to have them in the code. Sure. > > ... > >> #define DEV3TC 0x01003C >> #define BTCS 0x010040 >> #define BTCOMPARE 0x010044 >> -#define GPIOBASE 0x050000 > > ... > >> +#define GPIOBASE 0x050000 > > I think this one belongs to the header. I think it would be better to put it in gpio.c, after all it belongs to the GPIO module and is not used elsewhere. It doesn't feel good if we put it in the header file. -- BR, Jackie Liu
On Wed, Mar 30, 2022 at 09:46:07AM +0800, Jackie Liu wrote: > > > 在 2022/3/29 下午8:54, Andy Shevchenko 写道: > > On Tue, Mar 29, 2022 at 4:46 AM Jackie Liu <liu.yun@linux.dev> wrote: > > > > > > From: Jackie Liu <liuyun01@kylinos.cn> > > > > > > My kernel robot report build error from drivers/iio/adc/da9150-gpadc.c, > > > > > > We define GPIOD in rb.h, in fact he should only be used in gpio.c, but > > > > he --> it > > > > > it affects the driver da9150-gpadc.c which goes against the original > > > intention of the design, just move it to his scope. > > > > > At the same time, GPIONMIEN and IMASK6 are not used anywhere, just delete > > > them. > > > > While not being used it's good to leave (save) them since it might be > > the only means of the HW documentation. I know that Git history will > > keep that, but it is more explicit just to have them in the code. > > Sure. > > > > > ... > > > > > #define DEV3TC 0x01003C > > > #define BTCS 0x010040 > > > #define BTCOMPARE 0x010044 > > > -#define GPIOBASE 0x050000 > > > > ... > > > > > +#define GPIOBASE 0x050000 > > > > I think this one belongs to the header. > > I think it would be better to put it in gpio.c, after all it belongs to > the GPIO module and is not used elsewhere. It doesn't feel good if we > put it in the header file. I have a patchset, where the both files will go away. No need to clean up now. Thomas.
On Wed, Mar 30, 2022 at 9:45 AM Thomas Bogendoerfer <tsbogend@alpha.franken.de> wrote: > On Wed, Mar 30, 2022 at 09:46:07AM +0800, Jackie Liu wrote: > > 在 2022/3/29 下午8:54, Andy Shevchenko 写道: ... > > I think it would be better to put it in gpio.c, after all it belongs to > > the GPIO module and is not used elsewhere. It doesn't feel good if we > > put it in the header file. > > I have a patchset, where the both files will go away. No need to > clean up now. Do you plan them to be backported? If not, I would recommend applying this patch in order to have it backported and then do whatever you want we those files.
On Wed, Mar 30, 2022 at 12:23:59PM +0300, Andy Shevchenko wrote: > On Wed, Mar 30, 2022 at 9:45 AM Thomas Bogendoerfer > <tsbogend@alpha.franken.de> wrote: > > On Wed, Mar 30, 2022 at 09:46:07AM +0800, Jackie Liu wrote: > > > 在 2022/3/29 下午8:54, Andy Shevchenko 写道: > > ... > > > > I think it would be better to put it in gpio.c, after all it belongs to > > > the GPIO module and is not used elsewhere. It doesn't feel good if we > > > put it in the header file. > > > > I have a patchset, where the both files will go away. No need to > > clean up now. > > Do you plan them to be backported? If not, I would recommend applying no plan for backporting > this patch in order to have it backported and then do whatever you > want we those files. why ? This doesn't fix anything, doesn't it ? But if it makes people happy, I'll apply it. Thomas.
On Wed, Mar 30, 2022 at 12:32 PM Thomas Bogendoerfer <tsbogend@alpha.franken.de> wrote: > On Wed, Mar 30, 2022 at 12:23:59PM +0300, Andy Shevchenko wrote: > > On Wed, Mar 30, 2022 at 9:45 AM Thomas Bogendoerfer > > <tsbogend@alpha.franken.de> wrote: > > > On Wed, Mar 30, 2022 at 09:46:07AM +0800, Jackie Liu wrote: ... > > > I have a patchset, where the both files will go away. No need to > > > clean up now. > > > > Do you plan them to be backported? If not, I would recommend applying > > no plan for backporting > > > this patch in order to have it backported and then do whatever you > > want we those files. > > why ? This doesn't fix anything, doesn't it ? It fixes compilation breakage in some cases. I think the author of this patch can (should) elaborate. Also, it might need a Fixes tag. > But if it makes people happy, I'll apply it. Yes, please.
在 2022/3/30 下午5:41, Andy Shevchenko 写道: > On Wed, Mar 30, 2022 at 12:32 PM Thomas Bogendoerfer > <tsbogend@alpha.franken.de> wrote: >> On Wed, Mar 30, 2022 at 12:23:59PM +0300, Andy Shevchenko wrote: >>> On Wed, Mar 30, 2022 at 9:45 AM Thomas Bogendoerfer >>> <tsbogend@alpha.franken.de> wrote: >>>> On Wed, Mar 30, 2022 at 09:46:07AM +0800, Jackie Liu wrote: > > ... > >>>> I have a patchset, where the both files will go away. No need to >>>> clean up now. >>> >>> Do you plan them to be backported? If not, I would recommend applying >> >> no plan for backporting >> >>> this patch in order to have it backported and then do whatever you >>> want we those files. >> >> why ? This doesn't fix anything, doesn't it ? Like the patch I submitted in the first version, there are some gcc errors. [...] drivers/iio/adc/da9150-gpadc.c:254:13: error: ‘DA9150_GPADC_CHAN_0x08’ undeclared here (not in a function); did you mean ‘DA9150_GPADC_CHAN_TBAT’? 254 | .channel = DA9150_GPADC_CHAN_##_id, \ | ^~~~~~~~~~~~~~~~~~ drivers/iio/adc/da9150-gpadc.c:273:2: note: in expansion of macro ‘DA9150_GPADC_CHANNEL’ 273 | DA9150_GPADC_CHANNEL(_id, _hw_id, _type, \ | ^~~~~~~~~~~~~~~~~~~~ drivers/iio/adc/da9150-gpadc.c:281:2: note: in expansion of macro ‘DA9150_GPADC_CHANNEL_PROCESSED’ 281 | DA9150_GPADC_CHANNEL_PROCESSED(GPIOD, GPIOD_6V, IIO_VOLTAGE, NULL), | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ make[4]: *** [../scripts/Makefile.build:288: drivers/iio/adc/da9150-gpadc.o] Error 1 make[3]: *** [../scripts/Makefile.build:550: drivers/iio/adc] Error 2 make[3]: *** Waiting for unfinished jobs.... > > It fixes compilation breakage in some cases. I think the author of > this patch can (should) elaborate. > Also, it might need a Fixes tag. Um, it's really hard to say which commit is fixed, just because this header file defines a GPIOD, and someone else uses this later. > >> But if it makes people happy, I'll apply it. > > Yes, please. > -- Jackie Liu
On Wed, Mar 30, 2022 at 12:56 PM Jackie Liu <liu.yun@linux.dev> wrote: > 在 2022/3/30 下午5:41, Andy Shevchenko 写道: > > On Wed, Mar 30, 2022 at 12:32 PM Thomas Bogendoerfer > > <tsbogend@alpha.franken.de> wrote: ... > > It fixes compilation breakage in some cases. I think the author of > > this patch can (should) elaborate. > > Also, it might need a Fixes tag. > > Um, it's really hard to say which commit is fixed, just because this > header file defines a GPIOD, and someone else uses this later. I think we may use the original commit where the header in mips appeared with a justification that the definitions are not needed to be there and it may induce build errors, which in fact happens.
On Wed, Mar 30, 2022 at 05:56:03PM +0800, Jackie Liu wrote: > > 在 2022/3/30 下午5:41, Andy Shevchenko 写道: > > On Wed, Mar 30, 2022 at 12:32 PM Thomas Bogendoerfer > > <tsbogend@alpha.franken.de> wrote: > > > On Wed, Mar 30, 2022 at 12:23:59PM +0300, Andy Shevchenko wrote: > > > > On Wed, Mar 30, 2022 at 9:45 AM Thomas Bogendoerfer > > > > <tsbogend@alpha.franken.de> wrote: > > > > > On Wed, Mar 30, 2022 at 09:46:07AM +0800, Jackie Liu wrote: > > > > ... > > > > > > > I have a patchset, where the both files will go away. No need to > > > > > clean up now. > > > > > > > > Do you plan them to be backported? If not, I would recommend applying > > > > > > no plan for backporting > > > > > > > this patch in order to have it backported and then do whatever you > > > > want we those files. > > > > > > why ? This doesn't fix anything, doesn't it ? > > Like the patch I submitted in the first version, there are some gcc > errors. > > [...] > drivers/iio/adc/da9150-gpadc.c:254:13: error: ‘DA9150_GPADC_CHAN_0x08’ > undeclared here (not in a function); did you mean ‘DA9150_GPADC_CHAN_TBAT’? > 254 | .channel = DA9150_GPADC_CHAN_##_id, \ > | ^~~~~~~~~~~~~~~~~~ > drivers/iio/adc/da9150-gpadc.c:273:2: note: in expansion of macro > ‘DA9150_GPADC_CHANNEL’ > 273 | DA9150_GPADC_CHANNEL(_id, _hw_id, _type, \ > | ^~~~~~~~~~~~~~~~~~~~ > drivers/iio/adc/da9150-gpadc.c:281:2: note: in expansion of macro > ‘DA9150_GPADC_CHANNEL_PROCESSED’ > 281 | DA9150_GPADC_CHANNEL_PROCESSED(GPIOD, GPIOD_6V, IIO_VOLTAGE, > NULL), > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > make[4]: *** [../scripts/Makefile.build:288: drivers/iio/adc/da9150-gpadc.o] > Error 1 > make[3]: *** [../scripts/Makefile.build:550: drivers/iio/adc] Error 2 > make[3]: *** Waiting for unfinished jobs.... > > > > > It fixes compilation breakage in some cases. I think the author of > > this patch can (should) elaborate. > > Also, it might need a Fixes tag. > > > Um, it's really hard to say which commit is fixed, just because this > header file defines a GPIOD, and someone else uses this later. ok, now I got it. > > > But if it makes people happy, I'll apply it. > > > > Yes, please. will do, Thomas.
在 2022/3/30 下午6:01, Andy Shevchenko 写道: > On Wed, Mar 30, 2022 at 12:56 PM Jackie Liu <liu.yun@linux.dev> wrote: >> 在 2022/3/30 下午5:41, Andy Shevchenko 写道: >>> On Wed, Mar 30, 2022 at 12:32 PM Thomas Bogendoerfer >>> <tsbogend@alpha.franken.de> wrote: > > ... > >>> It fixes compilation breakage in some cases. I think the author of >>> this patch can (should) elaborate. >>> Also, it might need a Fixes tag. >> >> Um, it's really hard to say which commit is fixed, just because this >> header file defines a GPIOD, and someone else uses this later. > > I think we may use the original commit where the header in mips > appeared with a justification that the definitions are not needed to > be there and it may induce build errors, which in fact happens. > Sure, Thanks, I will send new patch v3 later. -- BR, Jackie Liu
diff --git a/arch/mips/include/asm/mach-rc32434/rb.h b/arch/mips/include/asm/mach-rc32434/rb.h index 34d179ca020b..dd9d4b026e62 100644 --- a/arch/mips/include/asm/mach-rc32434/rb.h +++ b/arch/mips/include/asm/mach-rc32434/rb.h @@ -29,15 +29,6 @@ #define DEV3TC 0x01003C #define BTCS 0x010040 #define BTCOMPARE 0x010044 -#define GPIOBASE 0x050000 -/* Offsets relative to GPIOBASE */ -#define GPIOFUNC 0x00 -#define GPIOCFG 0x04 -#define GPIOD 0x08 -#define GPIOILEVEL 0x0C -#define GPIOISTAT 0x10 -#define GPIONMIEN 0x14 -#define IMASK6 0x38 #define LO_WPX (1 << 0) #define LO_ALE (1 << 1) #define LO_CLE (1 << 2) diff --git a/arch/mips/rb532/gpio.c b/arch/mips/rb532/gpio.c index 94f02ada4082..43e188d53a49 100644 --- a/arch/mips/rb532/gpio.c +++ b/arch/mips/rb532/gpio.c @@ -37,6 +37,14 @@ #include <asm/mach-rc32434/rb.h> #include <asm/mach-rc32434/gpio.h> +#define GPIOBASE 0x050000 +/* Offsets relative to GPIOBASE */ +#define GPIOFUNC 0x00 +#define GPIOCFG 0x04 +#define GPIOD 0x08 +#define GPIOILEVEL 0x0C +#define GPIOISTAT 0x10 + struct rb532_gpio_chip { struct gpio_chip chip; void __iomem *regbase;