Message ID | 1564322446-28255-2-git-send-email-akinobu.mita@gmail.com (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | rename LED_OFF and LED_ON to avoid name collision with leds subsystem | expand |
Hi Akinobu, On 7/28/19 4:00 PM, Akinobu Mita wrote: > The umem driver defines LED_* macros for MEMCTRLCMD_LEDCTRL register > values. The LED_OFF and LED_ON macros conflict with the LED subsystem's > LED_OFF and LED_ON enums. > > This renames these LED_* macros to LEDCTRL_* in umem driver. [...] > > diff --git a/drivers/block/umem.h b/drivers/block/umem.h > index 5838497..8563fdc 100644 > --- a/drivers/block/umem.h > +++ b/drivers/block/umem.h > @@ -32,16 +32,16 @@ > #define MEM_2_GB 0xe0 > > #define MEMCTRLCMD_LEDCTRL 0x08 > -#define LED_REMOVE 2 > -#define LED_FAULT 4 > -#define LED_POWER 6 > -#define LED_FLIP 255 > -#define LED_OFF 0x00 > -#define LED_ON 0x01 > -#define LED_FLASH_3_5 0x02 > -#define LED_FLASH_7_0 0x03 > -#define LED_POWER_ON 0x00 > -#define LED_POWER_OFF 0x01 > +#define LEDCTRL_REMOVE 2 This way the namespacing prefix still begins with "LED", which can lead to further conflicts in the future. > +#define LEDCTRL_FAULT 4 > +#define LEDCTRL_POWER 6 > +#define LEDCTRL_FLIP 255 > +#define LEDCTRL_OFF 0x00 > +#define LEDCTRL_ON 0x01 > +#define LEDCTRL_FLASH_3_5 0x02 > +#define LEDCTRL_FLASH_7_0 0x03 > +#define LEDCTRL_POWER_ON 0x00 > +#define LEDCTRL_POWER_OFF 0x01 > #define USER_BIT1 0x01 > #define USER_BIT2 0x02 > >
On 7/28/19 4:00 PM, Akinobu Mita wrote: > The umem driver defines LED_* macros for MEMCTRLCMD_LEDCTRL register > values. The LED_OFF and LED_ON macros conflict with the LED subsystem's > LED_OFF and LED_ON enums. > > This renames these LED_* macros to LEDCTRL_* in umem driver. > > Cc: Frank Steiner <fsteiner-mail1@bio.ifi.lmu.de> > Cc: Jacek Anaszewski <jacek.anaszewski@gmail.com> > Cc: Pavel Machek <pavel@ucw.cz> > Cc: Dan Murphy <dmurphy@ti.com> > Cc: Jens Axboe <axboe@kernel.dk> > Cc: "James E.J. Bottomley" <jejb@linux.ibm.com> > Cc: "Martin K. Petersen" <martin.petersen@oracle.com> > Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> > --- > drivers/block/umem.c | 20 ++++++++++---------- > drivers/block/umem.h | 20 ++++++++++---------- > 2 files changed, 20 insertions(+), 20 deletions(-) > Reviewed-by: Hannes Reinecke <hare@suse.com> Cheers, Hannes
2019年7月29日(月) 2:30 Jacek Anaszewski <jacek.anaszewski@gmail.com>: > > Hi Akinobu, > > On 7/28/19 4:00 PM, Akinobu Mita wrote: > > The umem driver defines LED_* macros for MEMCTRLCMD_LEDCTRL register > > values. The LED_OFF and LED_ON macros conflict with the LED subsystem's > > LED_OFF and LED_ON enums. > > > > This renames these LED_* macros to LEDCTRL_* in umem driver. > [...] > > > > diff --git a/drivers/block/umem.h b/drivers/block/umem.h > > index 5838497..8563fdc 100644 > > --- a/drivers/block/umem.h > > +++ b/drivers/block/umem.h > > @@ -32,16 +32,16 @@ > > #define MEM_2_GB 0xe0 > > > > #define MEMCTRLCMD_LEDCTRL 0x08 > > -#define LED_REMOVE 2 > > -#define LED_FAULT 4 > > -#define LED_POWER 6 > > -#define LED_FLIP 255 > > -#define LED_OFF 0x00 > > -#define LED_ON 0x01 > > -#define LED_FLASH_3_5 0x02 > > -#define LED_FLASH_7_0 0x03 > > -#define LED_POWER_ON 0x00 > > -#define LED_POWER_OFF 0x01 > > +#define LEDCTRL_REMOVE 2 > > This way the namespacing prefix still begins with "LED", > which can lead to further conflicts in the future. How about renaming 'LED_ON' to 'MEMCTRLCMD_LEDCTRL_ON', and 'LED_OFF' to 'MEMCTRLCMD_LEDCTRL_OFF' ?
On Tue 2019-07-30 00:21:14, Akinobu Mita wrote: > 2019年7月29日(月) 2:30 Jacek Anaszewski <jacek.anaszewski@gmail.com>: > > > > Hi Akinobu, > > > > On 7/28/19 4:00 PM, Akinobu Mita wrote: > > > The umem driver defines LED_* macros for MEMCTRLCMD_LEDCTRL register > > > values. The LED_OFF and LED_ON macros conflict with the LED subsystem's > > > LED_OFF and LED_ON enums. > > > > > > This renames these LED_* macros to LEDCTRL_* in umem driver. > > [...] > > > > > > diff --git a/drivers/block/umem.h b/drivers/block/umem.h > > > index 5838497..8563fdc 100644 > > > --- a/drivers/block/umem.h > > > +++ b/drivers/block/umem.h > > > @@ -32,16 +32,16 @@ > > > #define MEM_2_GB 0xe0 > > > > > > #define MEMCTRLCMD_LEDCTRL 0x08 > > > -#define LED_REMOVE 2 > > > -#define LED_FAULT 4 > > > -#define LED_POWER 6 > > > -#define LED_FLIP 255 > > > -#define LED_OFF 0x00 > > > -#define LED_ON 0x01 > > > -#define LED_FLASH_3_5 0x02 > > > -#define LED_FLASH_7_0 0x03 > > > -#define LED_POWER_ON 0x00 > > > -#define LED_POWER_OFF 0x01 > > > +#define LEDCTRL_REMOVE 2 > > > > This way the namespacing prefix still begins with "LED", > > which can lead to further conflicts in the future. > > How about renaming 'LED_ON' to 'MEMCTRLCMD_LEDCTRL_ON', and 'LED_OFF' to > 'MEMCTRLCMD_LEDCTRL_OFF' ? I'd say that "MEMCTRL_LED_ON" woudl e enough, but... :-). Pavel
On 7/29/19 9:13 PM, Pavel Machek wrote: > On Tue 2019-07-30 00:21:14, Akinobu Mita wrote: >> 2019年7月29日(月) 2:30 Jacek Anaszewski <jacek.anaszewski@gmail.com>: >>> >>> Hi Akinobu, >>> >>> On 7/28/19 4:00 PM, Akinobu Mita wrote: >>>> The umem driver defines LED_* macros for MEMCTRLCMD_LEDCTRL register >>>> values. The LED_OFF and LED_ON macros conflict with the LED subsystem's >>>> LED_OFF and LED_ON enums. >>>> >>>> This renames these LED_* macros to LEDCTRL_* in umem driver. >>> [...] >>>> >>>> diff --git a/drivers/block/umem.h b/drivers/block/umem.h >>>> index 5838497..8563fdc 100644 >>>> --- a/drivers/block/umem.h >>>> +++ b/drivers/block/umem.h >>>> @@ -32,16 +32,16 @@ >>>> #define MEM_2_GB 0xe0 >>>> >>>> #define MEMCTRLCMD_LEDCTRL 0x08 >>>> -#define LED_REMOVE 2 >>>> -#define LED_FAULT 4 >>>> -#define LED_POWER 6 >>>> -#define LED_FLIP 255 >>>> -#define LED_OFF 0x00 >>>> -#define LED_ON 0x01 >>>> -#define LED_FLASH_3_5 0x02 >>>> -#define LED_FLASH_7_0 0x03 >>>> -#define LED_POWER_ON 0x00 >>>> -#define LED_POWER_OFF 0x01 >>>> +#define LEDCTRL_REMOVE 2 >>> >>> This way the namespacing prefix still begins with "LED", >>> which can lead to further conflicts in the future. >> >> How about renaming 'LED_ON' to 'MEMCTRLCMD_LEDCTRL_ON', and 'LED_OFF' to >> 'MEMCTRLCMD_LEDCTRL_OFF' ? > > I'd say that "MEMCTRL_LED_ON" woudl e enough, but... :-). I agree, it looks neater.
diff --git a/drivers/block/umem.c b/drivers/block/umem.c index 1f3f9e0..ea63c14 100644 --- a/drivers/block/umem.c +++ b/drivers/block/umem.c @@ -167,14 +167,14 @@ static int set_userbit(struct cardinfo *card, int bit, unsigned char state) } /* - * NOTE: For the power LED, use the LED_POWER_* macros since they differ + * NOTE: For the power LED, use the LEDCTRL_POWER_* macros since they differ */ static void set_led(struct cardinfo *card, int shift, unsigned char state) { unsigned char led; led = readb(card->csr_remap + MEMCTRLCMD_LEDCTRL); - if (state == LED_FLIP) + if (state == LEDCTRL_FLIP) led ^= (1<<shift); else { led &= ~(0x03 << shift); @@ -268,7 +268,7 @@ static void mm_start_io(struct cardinfo *card) if (debug & DEBUG_LED_ON_TRANSFER) - set_led(card, LED_REMOVE, LED_ON); + set_led(card, LEDCTRL_REMOVE, LEDCTRL_ON); desc = &page->desc[page->headcnt]; writel(0, card->csr_remap + DMA_PCI_ADDR); @@ -477,7 +477,7 @@ static void process_page(unsigned long data) } if (debug & DEBUG_LED_ON_TRANSFER) - set_led(card, LED_REMOVE, LED_OFF); + set_led(card, LEDCTRL_REMOVE, LEDCTRL_OFF); if (card->check_batteries) { card->check_batteries = 0; @@ -652,13 +652,13 @@ HW_TRACE(0x36); static void set_fault_to_battery_status(struct cardinfo *card) { if (card->battery[0].good && card->battery[1].good) - set_led(card, LED_FAULT, LED_OFF); + set_led(card, LEDCTRL_FAULT, LEDCTRL_OFF); else if (card->battery[0].warned || card->battery[1].warned) - set_led(card, LED_FAULT, LED_ON); + set_led(card, LEDCTRL_FAULT, LEDCTRL_ON); else if (!card->battery[0].good && !card->battery[1].good) - set_led(card, LED_FAULT, LED_FLASH_7_0); + set_led(card, LEDCTRL_FAULT, LEDCTRL_FLASH_7_0); else - set_led(card, LED_FAULT, LED_FLASH_3_5); + set_led(card, LEDCTRL_FAULT, LEDCTRL_FLASH_3_5); } static void init_battery_timer(void); @@ -919,8 +919,8 @@ static int mm_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) } /* Clear the LED's we control */ - set_led(card, LED_REMOVE, LED_OFF); - set_led(card, LED_FAULT, LED_OFF); + set_led(card, LEDCTRL_REMOVE, LEDCTRL_OFF); + set_led(card, LEDCTRL_FAULT, LEDCTRL_OFF); batt_status = readb(card->csr_remap + MEMCTRLSTATUS_BATTERY); diff --git a/drivers/block/umem.h b/drivers/block/umem.h index 5838497..8563fdc 100644 --- a/drivers/block/umem.h +++ b/drivers/block/umem.h @@ -32,16 +32,16 @@ #define MEM_2_GB 0xe0 #define MEMCTRLCMD_LEDCTRL 0x08 -#define LED_REMOVE 2 -#define LED_FAULT 4 -#define LED_POWER 6 -#define LED_FLIP 255 -#define LED_OFF 0x00 -#define LED_ON 0x01 -#define LED_FLASH_3_5 0x02 -#define LED_FLASH_7_0 0x03 -#define LED_POWER_ON 0x00 -#define LED_POWER_OFF 0x01 +#define LEDCTRL_REMOVE 2 +#define LEDCTRL_FAULT 4 +#define LEDCTRL_POWER 6 +#define LEDCTRL_FLIP 255 +#define LEDCTRL_OFF 0x00 +#define LEDCTRL_ON 0x01 +#define LEDCTRL_FLASH_3_5 0x02 +#define LEDCTRL_FLASH_7_0 0x03 +#define LEDCTRL_POWER_ON 0x00 +#define LEDCTRL_POWER_OFF 0x01 #define USER_BIT1 0x01 #define USER_BIT2 0x02
The umem driver defines LED_* macros for MEMCTRLCMD_LEDCTRL register values. The LED_OFF and LED_ON macros conflict with the LED subsystem's LED_OFF and LED_ON enums. This renames these LED_* macros to LEDCTRL_* in umem driver. Cc: Frank Steiner <fsteiner-mail1@bio.ifi.lmu.de> Cc: Jacek Anaszewski <jacek.anaszewski@gmail.com> Cc: Pavel Machek <pavel@ucw.cz> Cc: Dan Murphy <dmurphy@ti.com> Cc: Jens Axboe <axboe@kernel.dk> Cc: "James E.J. Bottomley" <jejb@linux.ibm.com> Cc: "Martin K. Petersen" <martin.petersen@oracle.com> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> --- drivers/block/umem.c | 20 ++++++++++---------- drivers/block/umem.h | 20 ++++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-)