Linux Documentation
 help / color / mirror / Atom feed
From: subramanian.mohan@intel.com
To: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: giometti@enneenne.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, subramanian.mohan@intel.com
Subject: [PATCH 1/1] pps: retrieve generator specific data from framework
Date: Tue, 28 Jan 2025 19:32:41 +0530	[thread overview]
Message-ID: <20250128140241.46489-1-subramanian.mohan@intel.com> (raw)

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
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;

	/* TIO Specific Data */
};

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;

    /* Access tio members here to set some of the parameters */

    return 0;
}

Signed-off-by: Subramanian Mohan <subramanian.mohan@intel.com>
---
 include/linux/pps_gen_kernel.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/pps_gen_kernel.h b/include/linux/pps_gen_kernel.h
index 022ea0ac4440..8484bb2828ef 100644
--- a/include/linux/pps_gen_kernel.h
+++ b/include/linux/pps_gen_kernel.h
@@ -35,6 +35,7 @@ struct pps_gen_source_info {
 	int (*get_time)(struct pps_gen_device *pps_gen,
 					struct timespec64 *time);
 	int (*enable)(struct pps_gen_device *pps_gen, bool enable);
+	void *drv_prv_data;
 
 /* private: internal use only */
 	struct module *owner;
-- 
2.35.3


             reply	other threads:[~2025-01-28 14:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-28 14:02 subramanian.mohan [this message]
2025-01-28 14:06 ` [PATCH 1/1] pps: retrieve generator specific data from framework Mohan, Subramanian

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=20250128140241.46489-1-subramanian.mohan@intel.com \
    --to=subramanian.mohan@intel.com \
    --cc=bagasdotme@gmail.com \
    --cc=david.zage@intel.com \
    --cc=giometti@enneenne.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=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