From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: subramanian.mohan@intel.com
Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
akpm@linux-foundation.org, greg@kroah.com, corbet@lwn.net,
christopher.s.hall@intel.com, tglx@linutronix.de,
eddie.dong@intel.com, pandith.n@intel.com,
thejesh.reddy.t.r@intel.com, david.zage@intel.com,
srinivasan.chinnadurai@intel.com, rdunlap@infradead.org,
bagasdotme@gmail.com, giometti@enneenne.com
Subject: Re: [PATCH v2 1/1] pps: retrieve generator specific data from framework
Date: Wed, 29 Jan 2025 08:53:44 +0200 [thread overview]
Message-ID: <Z5nQeAFx3UlI9hxE@smile.fi.intel.com> (raw)
In-Reply-To: <20250128141743.52031-1-subramanian.mohan@intel.com>
On Tue, Jan 28, 2025 at 07:47:43PM +0530, subramanian.mohan@intel.com wrote:
> From: Subramanian Mohan <subramanian.mohan@intel.com>
>
> While adapting pps generator driver(tio generator as an example)to the new
> generator framework, As part of driver registration the pps_gen_device
> pointer is returned from framework. Due to which there is difficulty in
> getting generator driver data back in enable function. we won’t be able
> to use container_of macro as it results in static assert. we might end up
container_of()
Can you be more specific, what exactly happens?
> in using static pointer. To avoid the same and get back the generator
> driver data back we are proposing generic approach to add drv_prv_data
> pointer inside the struct pps_gen_source_info.
> Example TIO structure wrapped with pps_gen_device and usage.
>
> struct pps_tio {
> /* Framework Related * /
> struct pps_gen_source_info pps_tio_source_info
> struct pps_gen_device *pps_gen;
> };
> static int pps_tio_enable(struct pps_gen_device *pps_gen, bool enable) {
>
> /* Getting TIO data back */
> /* Note: drv_prv_data will be initialized in our init routine */
> struct pps_tio *tio = pps_gen->info.drv_prv_data;
So, what's wrong with the container_of() against pps_gen->info?
We have tons of code in the kernel that does it.
> /* Access tio members here to set some of the parameters */
>
> return 0;
> }
Okay, looking into the implementation I see what's the issue (but it doesn't
mean that commit message is good here, you still need to explain better why
you can't get the correct address).
The problem is that info is got fully copied. Perhaps we should rely on
the fact that it always be provided? I dunno any data structure that defines
callbacks and other "info" material should be considered as temporary storage
(on stack), it makes not much sense.
...
> V1 -> V2:
> * Updated reviewers.
Please, use...
> Signed-off-by: Subramanian Mohan <subramanian.mohan@intel.com>
> ---
...this place for the comments and changelogs.
...
> + void *drv_prv_data;
If really needed we should probably use a better name, like "private".
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2025-01-29 6:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-28 14:17 subramanian.mohan
2025-01-29 6:53 ` Andy Shevchenko [this message]
2025-01-29 9:30 ` Mohan, Subramanian
2025-01-29 10:04 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z5nQeAFx3UlI9hxE@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=bagasdotme@gmail.com \
--cc=christopher.s.hall@intel.com \
--cc=corbet@lwn.net \
--cc=david.zage@intel.com \
--cc=eddie.dong@intel.com \
--cc=giometti@enneenne.com \
--cc=greg@kroah.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pandith.n@intel.com \
--cc=rdunlap@infradead.org \
--cc=srinivasan.chinnadurai@intel.com \
--cc=subramanian.mohan@intel.com \
--cc=tglx@linutronix.de \
--cc=thejesh.reddy.t.r@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome