Re: [PATCH] rtc: pcf8523: rename REG_OFFSET register

Randy Dunlap
2021-06-08T17:07:51Z

On 6/8/21 5:24 AM, Alexandre Belloni wrote:
> On 06/06/2021 09:24:23-0700, Randy Dunlap wrote:
>> REG_OFFSET is defined both here and in arch/arm/mach-ixp4xx/, which
>> causes a build warning, so rename this macro in the RTC driver.
>>
>> ../drivers/rtc/rtc-pcf8523.c:44: warning: "REG_OFFSET" redefined
>> 44 | #define REG_OFFSET 0x0e
>>
>> ../arch/arm/mach-ixp4xx/include/mach/platform.h:25: note: this is the location of the previous definition
>> 25 | #define REG_OFFSET 3
>>
>> Fixes: bc3bee025272 ("rtc: pcf8523: add support for trimming the RTC oscillator")
>> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
>> Reported-by: kernel test robot <lkp@intel.com>
>> Cc: Russell King <rmk+kernel@armlinux.org.uk>
>> Cc: Alessandro Zummo <a.zummo@towertech.it>
>> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
>> Cc: linux-rtc@vger.kernel.org
>> ---
>> drivers/rtc/rtc-pcf8523.c | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> --- linux-next-20210604.orig/drivers/rtc/rtc-pcf8523.c
>> +++ linux-next-20210604/drivers/rtc/rtc-pcf8523.c
>> @@ -41,7 +41,7 @@
>> #define REG_WEEKDAY_ALARM 0x0d
>> #define ALARM_DIS BIT(7)
>>
>> -#define REG_OFFSET 0x0e
>> +#define REG_OFFSET_TUNE 0x0e /* offset register is used for tuning */
>
> All the other defines are using the names from the datasheet, probably
> ixp4xx should be fixed instead?

That would be something like 25 changes in 14 files instead
of 3 changes in one file.

But for both locations, names like REG_OFFSET are just too generic.
They should be more specific so that name clashes won't happen.

--
~Randy