Re: [PATCH v1 1/5] rtc: rtc-cmos: Call cmos_wake_setup() from cmos_do_probe()

From: Zhang Rui
Date: Tue Nov 08 2022 - 10:42:00 EST


On Tue, 2022-11-08 at 14:09 +0100, Rafael J. Wysocki wrote:
> On Tue, Nov 8, 2022 at 3:31 AM Zhang Rui <rui.zhang@xxxxxxxxx> wrote:
> > On Mon, 2022-11-07 at 20:59 +0100, Rafael J. Wysocki wrote:
> > > From: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
> > >
> > > Notice that cmos_wake_setup() is the only user of acpi_rtc_info
> > > and
> > > it
> > > can operate on the cmos_rtc variable directly, so it need not set
> > > the
> > > platform_data pointer before cmos_do_probe() is called. Instead,
> > > it
> > > can be called by cmos_do_probe() in the case when the
> > > platform_data
> > > pointer is not set to implement the default behavior (which is to
> > > use
> > > the FADT information as long as ACPI support is enabled).
> > >
> >
> > ...
> >
> > > @@ -827,19 +829,27 @@ cmos_do_probe(struct device *dev, struct
> > > if (info->address_space)
> > > address_space = info->address_space;
> > >
> > > - if (info->rtc_day_alarm && info->rtc_day_alarm <
> > > 128)
> > > - cmos_rtc.day_alrm = info->rtc_day_alarm;
> > > - if (info->rtc_mon_alarm && info->rtc_mon_alarm <
> > > 128)
> > > - cmos_rtc.mon_alrm = info->rtc_mon_alarm;
> > > - if (info->rtc_century && info->rtc_century < 128)
> > > - cmos_rtc.century = info->rtc_century;
> > > + cmos_rtc.day_alrm = info->rtc_day_alarm;
> > > + cmos_rtc.mon_alrm = info->rtc_mon_alarm;
> > > + cmos_rtc.century = info->rtc_century;
> > >
> > > if (info->wake_on && info->wake_off) {
> > > cmos_rtc.wake_on = info->wake_on;
> > > cmos_rtc.wake_off = info->wake_off;
> > > }
> > > + } else {
> > > + cmos_wake_setup(dev);
> > > }
> > >
> > >
> >
> > Previously, before commit a474aaedac99 ("rtc-cmos: move wake setup
> > from
> > ACPI glue into RTC driver"), dev->platform_data is set in
> > drivers/acpi/glue.c, and the above commit moves it to
> > cmos_wake_setup()
> > in this file.
> >
> > Now, with this patch, my understanding is that dev->platform_data
> > is
> > never set, thus we can remove the 'info' variable and the
> > if (info)
> > check above.
>
> There are other users of this driver which can be found by grepping
> for cmos_rtc_board_info.
>
> They create platform device objects with platform_data set which are
> then bound to by this driver.

yeah, I overlooked this.

thanks,
rui