Skip to contentSkip to conversation

rtc: add devm_rtc_device_{register,unregister}()

PATCH Jingoo Han 2 participants 3 messages Mar 6, 2013

lore
Share & tools
lore

Jingoo Han

author
#0 lore raw
Quoted 16 lines · Venu Byravarasu
Quoted 16 lines
drivers/rtc/class.c +10 -0
 
+/**
+ * devm_rtc_device_register - resource managed rtc_device_register()
+ * @name: the name of the device
+ * @dev: the device to register
+ * @ops: the rtc operations structure
+ * @owner: the module owner
+ *
+ * @return a struct rtc on success, or an ERR_PTR on error
+ *
+ * Managed rtc_device_register(). The rtc_device returned from this

function
+ * are automatically freed on driver detach. See rtc_device_register()

Quoted 8 lines

drivers/rtc/class.c

Quoted 5 lines

+ * for more information.
+ */

drivers/rtc/class.c +3 -0
+
+struct rtc_device *devm_rtc_device_register(const char *name,
+					struct device *dev,

As most of devm_* functions use " struct device *dev" as their first param, why not this function also modified to be in sync with them?

Yes, but, I want to sync with the form of rtc_device_register(). This function already uses 'struct device *dev' as second argument as below.

struct rtc_device *rtc_device_register(const char *name, struct device *dev,
const struct rtc_class_ops *ops, struct module *owner)

Best regards,
Jingoo Han

Quoted 5 lines

drivers/rtc/class.c

Quoted 5 lines
drivers/rtc/class.c +4 -0
+					const struct rtc_class_ops *ops,
+					struct module *owner)
+{
+	struct rtc_device **ptr, *rtc;

�淸�{.n�+돴윯돪�+%듚�깁負쪐w��{.n�+돴쪐{깸G쳺��{ay����,j�f"톒쉹��묎�z_溫(�쉸듶줷"얎�m����G쳺�◀?솳鈺�&x�~뤳턨O뺞촾퇉v�^�m��� �띠�◀?뻀�

#1 lore raw
Quoted 34 lines

-----Original Message-----
From: Jingoo Han [mailto:[email protected]]
Sent: Wednesday, March 06, 2013 11:43 AM
To: Venu Byravarasu
Cc: 'Andrew Morton'; [email protected]; 'Tejun Heo'; 'Greg KH'; 'Alessandro Zummo'; [email protected]; Jingoo Han
Subject: Re: [PATCH v3] rtc: add devm_rtc_device_{register,unregister}()

Quoted 16 lines · Venu Byravarasu
Quoted 16 lines
drivers/rtc/class.c +10 -0
 
+/**
+ * devm_rtc_device_register - resource managed rtc_device_register()
+ * @name: the name of the device
+ * @dev: the device to register
+ * @ops: the rtc operations structure
+ * @owner: the module owner
+ *
+ * @return a struct rtc on success, or an ERR_PTR on error
+ *
+ * Managed rtc_device_register(). The rtc_device returned from this

function
+ * are automatically freed on driver detach. See rtc_device_register()

Quoted 8 lines

drivers/rtc/class.c

Quoted 5 lines

+ * for more information.
+ */

drivers/rtc/class.c +3 -0
+
+struct rtc_device *devm_rtc_device_register(const char *name,
+					struct device *dev,

As most of devm_* functions use " struct device *dev" as their first param, why not this function also modified to be in sync with them?

Quoted 3 lines

Yes, but, I want to sync with the form of rtc_device_register(). This function already uses 'struct device *dev' as second argument as below.

IMO any kernel driver developer using devm_* API, expects struct device* as first argument. Breaking this policy for one module (RTC here) & making this API special, might not be a good idea. Anyhow, maintainers may add their comments on this.

Thanks,
Venu

Quoted 12 lines

struct rtc_device *rtc_device_register(const char *name, struct device *dev,
const struct rtc_class_ops *ops, struct module *owner)

Best regards,
Jingoo Han

Quoted 5 lines
Quoted 5 lines
drivers/rtc/class.c +4 -0
+					const struct rtc_class_ops *ops,
+					struct module *owner)
+{
+	struct rtc_device **ptr, *rtc;
author
#2 lore raw
Quoted 28 lines · Venu Byravarasu
Quoted 27 lines · Jingoo Han
Quoted 24 lines · Venu Byravarasu
Quoted 18 lines
drivers/rtc/class.c +10 -0
 
+/**
+ * devm_rtc_device_register - resource managed rtc_device_register()
+ * @name: the name of the device
+ * @dev: the device to register
+ * @ops: the rtc operations structure
+ * @owner: the module owner
+ *
+ * @return a struct rtc on success, or an ERR_PTR on error
+ *
+ * Managed rtc_device_register(). The rtc_device returned from this

function
+ * are automatically freed on driver detach. See rtc_device_register()
+ * for more information.
+ */

drivers/rtc/class.c

Quoted 3 lines
drivers/rtc/class.c +3 -0
+
+struct rtc_device *devm_rtc_device_register(const char *name,
+					struct device *dev,

As most of devm_* functions use " struct device *dev" as their first param, why not this function also modified to be in sync with them?

Quoted 7 lines
Quoted 3 lines

Yes, but, I want to sync with the form of rtc_device_register(). This function already uses 'struct device *dev' as second argument as below.

IMO any kernel driver developer using devm_* API, expects struct device* as first argument. Breaking this policy for one module (RTC here) & making this API special, might not be a good idea. Anyhow, maintainers may add their comments on this.

OK, I see.

I just look at other devm_* API. All devm_* APIs use 'struct device*' as first argument.

To prevent the confusion, I will send the patch that uses 'struct device*' as first argument as below.

struct rtc_device *devm_rtc_device_register(struct device *dev,
const char *name,

Thanks for your comment

Best regards,
Jingoo Han

Quoted 16 lines

Thanks,
Venu

Quoted 12 lines

struct rtc_device *rtc_device_register(const char *name, struct device *dev,
const struct rtc_class_ops *ops, struct module *owner)

Best regards,
Jingoo Han

Quoted 5 lines
Quoted 5 lines
drivers/rtc/class.c +4 -0
+					const struct rtc_class_ops *ops,
+					struct module *owner)
+{
+	struct rtc_device **ptr, *rtc;