Message ID | 1456750705-13579-2-git-send-email-ldewangan@nvidia.com |
---|---|
State | Superseded |
Headers | show |
On 29.02.2016 21:58, Laxman Dewangan wrote: > use macro REGMAP_IRQ_REG from regmap.h to initialise the > regmap irq table for max77686. Why? Any benefits? Best regards, Krzysztof > > Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> > --- > drivers/rtc/rtc-max77686.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/rtc/rtc-max77686.c b/drivers/rtc/rtc-max77686.c > index 39d529a..0cb422b 100644 > --- a/drivers/rtc/rtc-max77686.c > +++ b/drivers/rtc/rtc-max77686.c > @@ -174,12 +174,12 @@ static const unsigned int max77686_map[REG_RTC_END] = { > > static const struct regmap_irq max77686_rtc_irqs[] = { > /* RTC interrupts */ > - { .reg_offset = 0, .mask = MAX77686_RTCINT_RTC60S_MSK, }, > - { .reg_offset = 0, .mask = MAX77686_RTCINT_RTCA1_MSK, }, > - { .reg_offset = 0, .mask = MAX77686_RTCINT_RTCA2_MSK, }, > - { .reg_offset = 0, .mask = MAX77686_RTCINT_SMPL_MSK, }, > - { .reg_offset = 0, .mask = MAX77686_RTCINT_RTC1S_MSK, }, > - { .reg_offset = 0, .mask = MAX77686_RTCINT_WTSR_MSK, }, > + REGMAP_IRQ_REG(0, 0, MAX77686_RTCINT_RTC60S_MSK), > + REGMAP_IRQ_REG(1, 0, MAX77686_RTCINT_RTCA1_MSK), > + REGMAP_IRQ_REG(2, 0, MAX77686_RTCINT_RTCA2_MSK), > + REGMAP_IRQ_REG(3, 0, MAX77686_RTCINT_SMPL_MSK), > + REGMAP_IRQ_REG(4, 0, MAX77686_RTCINT_RTC1S_MSK), > + REGMAP_IRQ_REG(5, 0, MAX77686_RTCINT_WTSR_MSK), > }; > > static const struct regmap_irq_chip max77686_rtc_irq_chip = { >
On Wednesday 02 March 2016 06:30 AM, Krzysztof Kozlowski wrote: > On 29.02.2016 21:58, Laxman Dewangan wrote: >> use macro REGMAP_IRQ_REG from regmap.h to initialise the >> regmap irq table for max77686. > Why? Any benefits? > > I think it is better coding to use macro for member initializations instead of doing it locally and it improves readability. I got the similar comment from Lee's in my MFD patches to use macro for such initialization and I agreed with him. As I was here on this driver, thought to use macro.
On 02.03.2016 11:04, Laxman Dewangan wrote: > > On Wednesday 02 March 2016 06:30 AM, Krzysztof Kozlowski wrote: >> On 29.02.2016 21:58, Laxman Dewangan wrote: >>> use macro REGMAP_IRQ_REG from regmap.h to initialise the >>> regmap irq table for max77686. >> Why? Any benefits? >> >> > I think it is better coding to use macro for member initializations > instead of doing it locally and it improves readability. > > I got the similar comment from Lee's in my MFD patches to use macro for > such initialization and I agreed with him. > > As I was here on this driver, thought to use macro. Sounds good, so this should be written in commit message. BR, Krzysztof
diff --git a/drivers/rtc/rtc-max77686.c b/drivers/rtc/rtc-max77686.c index 39d529a..0cb422b 100644 --- a/drivers/rtc/rtc-max77686.c +++ b/drivers/rtc/rtc-max77686.c @@ -174,12 +174,12 @@ static const unsigned int max77686_map[REG_RTC_END] = { static const struct regmap_irq max77686_rtc_irqs[] = { /* RTC interrupts */ - { .reg_offset = 0, .mask = MAX77686_RTCINT_RTC60S_MSK, }, - { .reg_offset = 0, .mask = MAX77686_RTCINT_RTCA1_MSK, }, - { .reg_offset = 0, .mask = MAX77686_RTCINT_RTCA2_MSK, }, - { .reg_offset = 0, .mask = MAX77686_RTCINT_SMPL_MSK, }, - { .reg_offset = 0, .mask = MAX77686_RTCINT_RTC1S_MSK, }, - { .reg_offset = 0, .mask = MAX77686_RTCINT_WTSR_MSK, }, + REGMAP_IRQ_REG(0, 0, MAX77686_RTCINT_RTC60S_MSK), + REGMAP_IRQ_REG(1, 0, MAX77686_RTCINT_RTCA1_MSK), + REGMAP_IRQ_REG(2, 0, MAX77686_RTCINT_RTCA2_MSK), + REGMAP_IRQ_REG(3, 0, MAX77686_RTCINT_SMPL_MSK), + REGMAP_IRQ_REG(4, 0, MAX77686_RTCINT_RTC1S_MSK), + REGMAP_IRQ_REG(5, 0, MAX77686_RTCINT_WTSR_MSK), }; static const struct regmap_irq_chip max77686_rtc_irq_chip = {
use macro REGMAP_IRQ_REG from regmap.h to initialise the regmap irq table for max77686. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> --- drivers/rtc/rtc-max77686.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)