linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Cosmin Tanislav <demonsingur@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: cosmin.tanislav@analog.com, demonsingur@gmail.com,
	Jean Delvare <jdelvare@suse.com>,
	Guenter Roeck <linux@roeck-us.net>,
	linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v1 02/10] hwmon: adt7x10: do not create name attr
Date: Tue, 21 Dec 2021 14:39:36 +0200	[thread overview]
Message-ID: <20211221123944.2683245-2-demonsingur@gmail.com> (raw)
In-Reply-To: <20211221123944.2683245-1-demonsingur@gmail.com>

From: Cosmin Tanislav <cosmin.tanislav@analog.com>

It will later be created automatically by hwmon.

Signed-off-by: Cosmin Tanislav <cosmin.tanislav@analog.com>
---
 drivers/hwmon/adt7x10.c | 29 +----------------------------
 1 file changed, 1 insertion(+), 28 deletions(-)

diff --git a/drivers/hwmon/adt7x10.c b/drivers/hwmon/adt7x10.c
index 2439da9b64e6..dbe9f1ad7db0 100644
--- a/drivers/hwmon/adt7x10.c
+++ b/drivers/hwmon/adt7x10.c
@@ -54,7 +54,6 @@
 /* Each client has this additional data */
 struct adt7x10_data {
 	const struct adt7x10_ops *ops;
-	const char		*name;
 	struct device		*hwmon_dev;
 	struct device		*bus_dev;
 	struct mutex		update_lock;
@@ -316,14 +315,6 @@ static ssize_t adt7x10_alarm_show(struct device *dev,
 	return sprintf(buf, "%d\n", !!(ret & attr->index));
 }
 
-static ssize_t name_show(struct device *dev, struct device_attribute *da,
-			 char *buf)
-{
-	struct adt7x10_data *data = dev_get_drvdata(dev);
-
-	return sprintf(buf, "%s\n", data->name);
-}
-
 static SENSOR_DEVICE_ATTR_RO(temp1_input, adt7x10_temp, 0);
 static SENSOR_DEVICE_ATTR_RW(temp1_max, adt7x10_temp, 1);
 static SENSOR_DEVICE_ATTR_RW(temp1_min, adt7x10_temp, 2);
@@ -337,7 +328,6 @@ static SENSOR_DEVICE_ATTR_RO(temp1_max_alarm, adt7x10_alarm,
 			     ADT7X10_STAT_T_HIGH);
 static SENSOR_DEVICE_ATTR_RO(temp1_crit_alarm, adt7x10_alarm,
 			     ADT7X10_STAT_T_CRIT);
-static DEVICE_ATTR_RO(name);
 
 static struct attribute *adt7x10_attributes[] = {
 	&sensor_dev_attr_temp1_input.dev_attr.attr,
@@ -368,7 +358,6 @@ int adt7x10_probe(struct device *dev, const char *name, int irq,
 		return -ENOMEM;
 
 	data->ops = ops;
-	data->name = name;
 	data->bus_dev = dev;
 
 	dev_set_drvdata(dev, data);
@@ -406,21 +395,10 @@ int adt7x10_probe(struct device *dev, const char *name, int irq,
 	if (ret)
 		goto exit_restore;
 
-	/*
-	 * The I2C device will already have it's own 'name' attribute, but for
-	 * the SPI device we need to register it. name will only be non NULL if
-	 * the device doesn't register the 'name' attribute on its own.
-	 */
-	if (name) {
-		ret = device_create_file(dev, &dev_attr_name);
-		if (ret)
-			goto exit_remove;
-	}
-
 	data->hwmon_dev = hwmon_device_register(dev);
 	if (IS_ERR(data->hwmon_dev)) {
 		ret = PTR_ERR(data->hwmon_dev);
-		goto exit_remove_name;
+		goto exit_remove;
 	}
 
 	if (irq > 0) {
@@ -435,9 +413,6 @@ int adt7x10_probe(struct device *dev, const char *name, int irq,
 
 exit_hwmon_device_unregister:
 	hwmon_device_unregister(data->hwmon_dev);
-exit_remove_name:
-	if (name)
-		device_remove_file(dev, &dev_attr_name);
 exit_remove:
 	sysfs_remove_group(&dev->kobj, &adt7x10_group);
 exit_restore:
@@ -454,8 +429,6 @@ void adt7x10_remove(struct device *dev, int irq)
 		free_irq(irq, dev);
 
 	hwmon_device_unregister(data->hwmon_dev);
-	if (data->name)
-		device_remove_file(dev, &dev_attr_name);
 	sysfs_remove_group(&dev->kobj, &adt7x10_group);
 	if (data->oldconfig != data->config)
 		adt7x10_write_byte(dev, ADT7X10_CONFIG, data->oldconfig);
-- 
2.34.1


  reply	other threads:[~2021-12-21 12:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-21 12:39 [PATCH v1 01/10] hwmon: adt7x10: store bus_dev in private data Cosmin Tanislav
2021-12-21 12:39 ` Cosmin Tanislav [this message]
2021-12-21 15:17   ` [PATCH v1 02/10] hwmon: adt7x10: do not create name attr Guenter Roeck
2021-12-21 12:39 ` [PATCH v1 03/10] hwmon: adt7x10: use devm_request_threaded_irq Cosmin Tanislav
2021-12-21 16:08   ` Guenter Roeck
2021-12-21 12:39 ` [PATCH v1 04/10] hwmon: adt7x10: avoid storing hwinfo dev into private data Cosmin Tanislav
2021-12-21 15:16   ` Guenter Roeck
2021-12-21 12:39 ` [PATCH v1 05/10] hwmon: adt7x10: pass hwinfo dev to irq handler Cosmin Tanislav
2021-12-21 12:39 ` [PATCH v1 06/10] hwmon: adt7x10: extract read/write methods from show/store Cosmin Tanislav
2021-12-21 12:39 ` [PATCH v1 07/10] hwmon: adt7x10: remove attrs Cosmin Tanislav
2021-12-21 15:23   ` Guenter Roeck
2021-12-21 12:39 ` [PATCH v1 08/10] hwmon: adt7x10: use hwmon_device_register_with_info Cosmin Tanislav
2021-12-21 12:39 ` [PATCH v1 09/10] hwmon: adt7x10: use devm_hwmon_device_register_with_info Cosmin Tanislav
2021-12-21 15:34   ` Guenter Roeck
2021-12-21 12:39 ` [PATCH v1 10/10] hwmon: adt7x10: use hwmon_notify_event Cosmin Tanislav

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=20211221123944.2683245-2-demonsingur@gmail.com \
    --to=demonsingur@gmail.com \
    --cc=cosmin.tanislav@analog.com \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    /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;
as well as URLs for NNTP newsgroup(s).