Skip to contentSkip to conversation

pps: retrieve generator specific data from framework

PATCH Superseded [email protected] 1 participant 2 messages Jan 28, 2025

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pps: retrieve generator specific data from framework

From: Subramanian Mohan <[email protected]>

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;
}
---
 include/linux/pps_gen_kernel.h | 1 +
 1 file changed, 1 insertion(+)
include/linux/pps_gen_kernel.h +1 -0
index 022ea0ac4440..8484bb2828ef 100644
@@ -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;
Signature · 1 line
2.35.3
#1 lore raw

Hi All,

Sorry for inconvenience.
Kindly ignore the V1 series.
V2 patch will be sent out accordingly.

Thanks,
Subbu

Quoted 62 lines

-----Original Message-----
From: Mohan, Subramanian <[email protected]>
Sent: Tuesday, January 28, 2025 7:33 PM
To: [email protected]; [email protected]
Cc: [email protected]; N, Pandith <[email protected]>; T R, Thejesh Reddy <[email protected]>; Zage, David <[email protected]>; Chinnadurai, Srinivasan <[email protected]>; [email protected]; [email protected]; Mohan, Subramanian <[email protected]>
Subject: [PATCH 1/1] pps: retrieve generator specific data from framework

From: Subramanian Mohan <[email protected]>

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;
}
---
 include/linux/pps_gen_kernel.h | 1 +
 1 file changed, 1 insertion(+)
include/linux/pps_gen_kernel.h +1 -1
index 022ea0ac4440..8484bb2828ef 100644
@@ -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