diff mbox series

hwmon: (it87): Switch to using the new API kobj_to_dev()

Message ID 1609377535-29964-1-git-send-email-tiantao6@hisilicon.com (mailing list archive)
State Accepted
Headers show
Series hwmon: (it87): Switch to using the new API kobj_to_dev() | expand

Commit Message

Tian Tao Dec. 31, 2020, 1:18 a.m. UTC
Switch to using the new API kobj_to_dev() to fix the below warnning:
drivers/hwmon/it87.c:2293:60-61: WARNING opportunity for kobj_to_dev()
drivers/hwmon/it87.c:2161:60-61: WARNING opportunity for kobj_to_dev()
drivers/hwmon/it87.c:1984:60-61: WARNING opportunity for kobj_to_dev()
drivers/hwmon/it87.c:2129:60-61: WARNING opportunity for kobj_to_dev()
drivers/hwmon/it87.c:2232:60-61: WARNING opportunity for kobj_to_dev()
drivers/hwmon/it87.c:2068:60-61: WARNING opportunity for kobj_to_dev()

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
---
 drivers/hwmon/it87.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Guenter Roeck Jan. 8, 2021, 3:37 p.m. UTC | #1
On Thu, Dec 31, 2020 at 09:18:55AM +0800, Tian Tao wrote:
> Switch to using the new API kobj_to_dev() to fix the below warnning:
> drivers/hwmon/it87.c:2293:60-61: WARNING opportunity for kobj_to_dev()
> drivers/hwmon/it87.c:2161:60-61: WARNING opportunity for kobj_to_dev()
> drivers/hwmon/it87.c:1984:60-61: WARNING opportunity for kobj_to_dev()
> drivers/hwmon/it87.c:2129:60-61: WARNING opportunity for kobj_to_dev()
> drivers/hwmon/it87.c:2232:60-61: WARNING opportunity for kobj_to_dev()
> drivers/hwmon/it87.c:2068:60-61: WARNING opportunity for kobj_to_dev()
> 
> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>

Applied.

Thanks,
Guenter
Guenter Roeck Jan. 9, 2021, 2:56 a.m. UTC | #2
On Fri, Jan 08, 2021 at 07:37:04AM -0800, Guenter Roeck wrote:
> On Thu, Dec 31, 2020 at 09:18:55AM +0800, Tian Tao wrote:
> > Switch to using the new API kobj_to_dev() to fix the below warnning:
> > drivers/hwmon/it87.c:2293:60-61: WARNING opportunity for kobj_to_dev()
> > drivers/hwmon/it87.c:2161:60-61: WARNING opportunity for kobj_to_dev()
> > drivers/hwmon/it87.c:1984:60-61: WARNING opportunity for kobj_to_dev()
> > drivers/hwmon/it87.c:2129:60-61: WARNING opportunity for kobj_to_dev()
> > drivers/hwmon/it87.c:2232:60-61: WARNING opportunity for kobj_to_dev()
> > drivers/hwmon/it87.c:2068:60-61: WARNING opportunity for kobj_to_dev()
> > 
> > Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
> 
> Applied.
> 

All error/warnings (new ones prefixed by >>):

   drivers/hwmon/it87.c: In function 'it87_auto_pwm_is_visible':
>> drivers/hwmon/it87.c:2293:23: error: implicit declaration of function 'konj_to_dev'; did you mean 'kobj_to_dev'?

Now dropped. If you can't test build your patches, please stop submitting
them.

Guenter
diff mbox series

Patch

diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
index fac9b5c..418a177 100644
--- a/drivers/hwmon/it87.c
+++ b/drivers/hwmon/it87.c
@@ -1981,7 +1981,7 @@  static SENSOR_DEVICE_ATTR(in9_label, S_IRUGO, show_label, NULL, 3);
 static umode_t it87_in_is_visible(struct kobject *kobj,
 				  struct attribute *attr, int index)
 {
-	struct device *dev = container_of(kobj, struct device, kobj);
+	struct device *dev = kobj_to_dev(kobj);
 	struct it87_data *data = dev_get_drvdata(dev);
 	int i = index / 5;	/* voltage index */
 	int a = index % 5;	/* attribute index */
@@ -2065,7 +2065,7 @@  static const struct attribute_group it87_group_in = {
 static umode_t it87_temp_is_visible(struct kobject *kobj,
 				    struct attribute *attr, int index)
 {
-	struct device *dev = container_of(kobj, struct device, kobj);
+	struct device *dev = kobj_to_dev(kobj);
 	struct it87_data *data = dev_get_drvdata(dev);
 	int i = index / 7;	/* temperature index */
 	int a = index % 7;	/* attribute index */
@@ -2126,7 +2126,7 @@  static const struct attribute_group it87_group_temp = {
 static umode_t it87_is_visible(struct kobject *kobj,
 			       struct attribute *attr, int index)
 {
-	struct device *dev = container_of(kobj, struct device, kobj);
+	struct device *dev = kobj_to_dev(kobj);
 	struct it87_data *data = dev_get_drvdata(dev);
 
 	if ((index == 2 || index == 3) && !data->has_vid)
@@ -2158,7 +2158,7 @@  static const struct attribute_group it87_group = {
 static umode_t it87_fan_is_visible(struct kobject *kobj,
 				   struct attribute *attr, int index)
 {
-	struct device *dev = container_of(kobj, struct device, kobj);
+	struct device *dev = kobj_to_dev(kobj);
 	struct it87_data *data = dev_get_drvdata(dev);
 	int i = index / 5;	/* fan index */
 	int a = index % 5;	/* attribute index */
@@ -2229,7 +2229,7 @@  static const struct attribute_group it87_group_fan = {
 static umode_t it87_pwm_is_visible(struct kobject *kobj,
 				   struct attribute *attr, int index)
 {
-	struct device *dev = container_of(kobj, struct device, kobj);
+	struct device *dev = kobj_to_dev(kobj);
 	struct it87_data *data = dev_get_drvdata(dev);
 	int i = index / 4;	/* pwm index */
 	int a = index % 4;	/* attribute index */
@@ -2290,7 +2290,7 @@  static const struct attribute_group it87_group_pwm = {
 static umode_t it87_auto_pwm_is_visible(struct kobject *kobj,
 					struct attribute *attr, int index)
 {
-	struct device *dev = container_of(kobj, struct device, kobj);
+	struct device *dev = konj_to_dev(kobj);
 	struct it87_data *data = dev_get_drvdata(dev);
 	int i = index / 11;	/* pwm index */
 	int a = index % 11;	/* attribute index */