* [PATCH 1/3] rtc: abx80x: convert to SPDX identifier
@ 2019-03-06 9:51 Alexandre Belloni
2019-03-06 9:51 ` [PATCH 2/3] rtc: abx80x: use rtc_add_group Alexandre Belloni
2019-03-06 9:51 ` [PATCH 3/3] rtc: abx80x: remove useless .remove Alexandre Belloni
0 siblings, 2 replies; 3+ messages in thread
From: Alexandre Belloni @ 2019-03-06 9:51 UTC (permalink / raw)
To: linux-rtc; +Cc: Alexandre Belloni
Use SPDX-License-Identifier instead of a verbose license text.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-abx80x.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/rtc/rtc-abx80x.c b/drivers/rtc/rtc-abx80x.c
index 6ddcad642d1e..8e7eb08281f7 100644
--- a/drivers/rtc/rtc-abx80x.c
+++ b/drivers/rtc/rtc-abx80x.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* A driver for the I2C members of the Abracon AB x8xx RTC family,
* and compatible: AB 1805 and AB 0805
@@ -7,10 +8,6 @@
* Author: Philippe De Muyter <phdm@macqel.be>
* Author: Alexandre Belloni <alexandre.belloni@bootlin.com>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
*/
#include <linux/bcd.h>
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/3] rtc: abx80x: use rtc_add_group
2019-03-06 9:51 [PATCH 1/3] rtc: abx80x: convert to SPDX identifier Alexandre Belloni
@ 2019-03-06 9:51 ` Alexandre Belloni
2019-03-06 9:51 ` [PATCH 3/3] rtc: abx80x: remove useless .remove Alexandre Belloni
1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Belloni @ 2019-03-06 9:51 UTC (permalink / raw)
To: linux-rtc; +Cc: Alexandre Belloni
Use rtc_add_group to add the sysfs group in a race free manner.
This has the side effect of moving the files to their proper location.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-abx80x.c | 32 ++++++--------------------------
1 file changed, 6 insertions(+), 26 deletions(-)
diff --git a/drivers/rtc/rtc-abx80x.c b/drivers/rtc/rtc-abx80x.c
index 8e7eb08281f7..90f25ac78abc 100644
--- a/drivers/rtc/rtc-abx80x.c
+++ b/drivers/rtc/rtc-abx80x.c
@@ -401,7 +401,7 @@ static ssize_t autocalibration_store(struct device *dev,
return -EINVAL;
}
- retval = abx80x_rtc_set_autocalibration(dev, autocalibration);
+ retval = abx80x_rtc_set_autocalibration(dev->parent, autocalibration);
return retval ? retval : count;
}
@@ -411,7 +411,7 @@ static ssize_t autocalibration_show(struct device *dev,
{
int autocalibration = 0;
- autocalibration = abx80x_rtc_get_autocalibration(dev);
+ autocalibration = abx80x_rtc_get_autocalibration(dev->parent);
if (autocalibration < 0) {
dev_err(dev, "Failed to read RTC autocalibration\n");
sprintf(buf, "0\n");
@@ -427,7 +427,7 @@ static ssize_t oscillator_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
- struct i2c_client *client = to_i2c_client(dev);
+ struct i2c_client *client = to_i2c_client(dev->parent);
int retval, flags, rc_mode = 0;
if (strncmp(buf, "rc", 2) == 0) {
@@ -469,7 +469,7 @@ static ssize_t oscillator_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
int rc_mode = 0;
- struct i2c_client *client = to_i2c_client(dev);
+ struct i2c_client *client = to_i2c_client(dev->parent);
rc_mode = abx80x_is_rc_mode(client);
@@ -589,13 +589,6 @@ static int abx80x_dt_trickle_cfg(struct device_node *np)
return (trickle_cfg | i);
}
-static void rtc_calib_remove_sysfs_group(void *_dev)
-{
- struct device *dev = _dev;
-
- sysfs_remove_group(&dev->kobj, &rtc_calib_attr_group);
-}
-
#ifdef CONFIG_WATCHDOG
static inline u8 timeout_bits(unsigned int timeout)
@@ -848,27 +841,14 @@ static int abx80x_probe(struct i2c_client *client,
}
}
- /* Export sysfs entries */
- err = sysfs_create_group(&(&client->dev)->kobj, &rtc_calib_attr_group);
+ err = rtc_add_group(priv->rtc, &rtc_calib_attr_group);
if (err) {
dev_err(&client->dev, "Failed to create sysfs group: %d\n",
err);
return err;
}
- err = devm_add_action_or_reset(&client->dev,
- rtc_calib_remove_sysfs_group,
- &client->dev);
- if (err) {
- dev_err(&client->dev,
- "Failed to add sysfs cleanup action: %d\n",
- err);
- return err;
- }
-
- err = rtc_register_device(priv->rtc);
-
- return err;
+ return rtc_register_device(priv->rtc);
}
static int abx80x_remove(struct i2c_client *client)
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 3/3] rtc: abx80x: remove useless .remove
2019-03-06 9:51 [PATCH 1/3] rtc: abx80x: convert to SPDX identifier Alexandre Belloni
2019-03-06 9:51 ` [PATCH 2/3] rtc: abx80x: use rtc_add_group Alexandre Belloni
@ 2019-03-06 9:51 ` Alexandre Belloni
1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Belloni @ 2019-03-06 9:51 UTC (permalink / raw)
To: linux-rtc; +Cc: Alexandre Belloni
.remove is empty, remove it.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-abx80x.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/drivers/rtc/rtc-abx80x.c b/drivers/rtc/rtc-abx80x.c
index 90f25ac78abc..73830670a41f 100644
--- a/drivers/rtc/rtc-abx80x.c
+++ b/drivers/rtc/rtc-abx80x.c
@@ -851,11 +851,6 @@ static int abx80x_probe(struct i2c_client *client,
return rtc_register_device(priv->rtc);
}
-static int abx80x_remove(struct i2c_client *client)
-{
- return 0;
-}
-
static const struct i2c_device_id abx80x_id[] = {
{ "abx80x", ABX80X },
{ "ab0801", AB0801 },
@@ -876,7 +871,6 @@ static struct i2c_driver abx80x_driver = {
.name = "rtc-abx80x",
},
.probe = abx80x_probe,
- .remove = abx80x_remove,
.id_table = abx80x_id,
};
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-03-06 9:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-06 9:51 [PATCH 1/3] rtc: abx80x: convert to SPDX identifier Alexandre Belloni
2019-03-06 9:51 ` [PATCH 2/3] rtc: abx80x: use rtc_add_group Alexandre Belloni
2019-03-06 9:51 ` [PATCH 3/3] rtc: abx80x: remove useless .remove Alexandre Belloni
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).