[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <PH7PR11MB5862339EA0E6E366457CFC28F7FB2@PH7PR11MB5862.namprd11.prod.outlook.com>
Date: Mon, 17 Feb 2025 02:46:14 +0000
From: "Mohan, Subramanian" <subramanian.mohan@...el.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"giometti@...eenne.com" <giometti@...eenne.com>, "tglx@...utronix.de"
<tglx@...utronix.de>, "corbet@....net" <corbet@....net>, "Dong, Eddie"
<eddie.dong@...el.com>, "Hall, Christopher S" <christopher.s.hall@...el.com>,
"N, Pandith" <pandith.n@...el.com>, "T R, Thejesh Reddy"
<thejesh.reddy.t.r@...el.com>, "Zage, David" <david.zage@...el.com>,
"Chinnadurai, Srinivasan" <srinivasan.chinnadurai@...el.com>
Subject: RE: [PATCH v14 1/4] drivers pps/generators: replace copy of pps-gen
info struct with const pointer
> -----Original Message-----
> From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> Sent: Friday, February 14, 2025 8:25 PM
> To: Mohan, Subramanian <subramanian.mohan@...el.com>
> Cc: linux-kernel@...r.kernel.org; linux-doc@...r.kernel.org;
> gregkh@...uxfoundation.org; giometti@...eenne.com; tglx@...utronix.de;
> corbet@....net; Dong, Eddie <eddie.dong@...el.com>; Hall, Christopher S
> <christopher.s.hall@...el.com>; N, Pandith <pandith.n@...el.com>; T R,
> Thejesh Reddy <thejesh.reddy.t.r@...el.com>; Zage, David
> <david.zage@...el.com>; Chinnadurai, Srinivasan
> <srinivasan.chinnadurai@...el.com>
> Subject: Re: [PATCH v14 1/4] drivers pps/generators: replace copy of pps-gen
> info struct with const pointer
>
> On Fri, Feb 14, 2025 at 02:37:52PM +0530, subramanian.mohan@...el.com
> wrote:
> > From: Subramanian Mohan <subramanian.mohan@...el.com>
> >
> > Some PPS generator drivers may need to retrieve a pointer to their
> > internal data while executing the PPS generator enable() method.
> >
> > During the driver registration the pps_gen_device pointer is returned
> > from the framework, and for that reason, there is difficulty in
> > getting generator driver data back in the enable function. We won't be
> > able to use container_of macro as it results in static assert, and we
> > might end up in using static pointer.
> >
> > To solve the issue and to get back the generator driver data back, we
> > should not copy the struct pps_gen_source_info within the struct
> > pps_gen_device during the registration stage, but simply save the
> > pointer of the driver one. In this manner, driver may get a pointer to
> > their internal data as shown below:
> >
> > struct pps_gen_foo_data_s {
> > ...
> > struct pps_gen_source_info gen_info;
> > struct pps_gen_device *pps_gen;
> > ...
> > };
> >
> > static int __init pps_gen_foo_init(void) {
> > struct pps_gen_foo_data_s *foo;
> > ...
> > foo->pps_gen = pps_gen_register_source(&foo->gen_info);
> > ...
> > }
> >
> > Then, in the enable() method, we can retrieve the pointer to the main
> > struct by using the code below:
> >
> > static int pps_gen_foo_enable(struct pps_gen_device *pps_gen, bool
> > enable) {
> > struct pps_gen_foo_data_s *foo = container_of(pps_gen->info,
> > struct pps_gen_foo_data_s,
> gen_info);
> > ...
> > }
>
> Shouldn't Subject start with "pps: generators: ..."?
>
> With that fixed,
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Sure Andy will modify the subject line as suggested and add Reviewed-by tag, Will resend v15 accordingly.
Thanks,
Subbu
>
> --
> With Best Regards,
> Andy Shevchenko
>
Powered by blists - more mailing lists