From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: linux-rtc@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
Alexandre Belloni <alexandre.belloni@bootlin.com>
Subject: [PATCH 23/45] rtc: ds1343: remove undocumented and useless sysfs files
Date: Mon, 12 Feb 2018 23:47:37 +0100 [thread overview]
Message-ID: <20180212224759.15999-24-alexandre.belloni@bootlin.com> (raw)
In-Reply-To: <20180212224759.15999-1-alexandre.belloni@bootlin.com>
A documented ABI already exists to get information about the alarm. It is
the only one that is used.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-ds1343.c | 96 +-----------------------------------------------
1 file changed, 1 insertion(+), 95 deletions(-)
diff --git a/drivers/rtc/rtc-ds1343.c b/drivers/rtc/rtc-ds1343.c
index a5a5a363c6e1..67cae0dd8154 100644
--- a/drivers/rtc/rtc-ds1343.c
+++ b/drivers/rtc/rtc-ds1343.c
@@ -199,74 +199,6 @@ static struct bin_attribute nvram_attr = {
.size = DS1343_NVRAM_LEN,
};
-static ssize_t ds1343_show_alarmstatus(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- struct ds1343_priv *priv = dev_get_drvdata(dev);
- int alarmstatus, data;
-
- regmap_read(priv->map, DS1343_CONTROL_REG, &data);
-
- alarmstatus = !!(data & DS1343_A0IE);
-
- if (alarmstatus)
- return sprintf(buf, "enabled\n");
- else
- return sprintf(buf, "disabled\n");
-}
-
-static DEVICE_ATTR(alarm_status, S_IRUGO, ds1343_show_alarmstatus, NULL);
-
-static ssize_t ds1343_show_alarmmode(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- struct ds1343_priv *priv = dev_get_drvdata(dev);
- int alarm_mode, data;
- char *alarm_str;
-
- regmap_read(priv->map, DS1343_ALM0_SEC_REG, &data);
- alarm_mode = (data & 0x80) >> 4;
-
- regmap_read(priv->map, DS1343_ALM0_MIN_REG, &data);
- alarm_mode |= (data & 0x80) >> 5;
-
- regmap_read(priv->map, DS1343_ALM0_HOUR_REG, &data);
- alarm_mode |= (data & 0x80) >> 6;
-
- regmap_read(priv->map, DS1343_ALM0_DAY_REG, &data);
- alarm_mode |= (data & 0x80) >> 7;
-
- switch (alarm_mode) {
- case 15:
- alarm_str = "each second";
- break;
-
- case 7:
- alarm_str = "seconds match";
- break;
-
- case 3:
- alarm_str = "minutes and seconds match";
- break;
-
- case 1:
- alarm_str = "hours, minutes and seconds match";
- break;
-
- case 0:
- alarm_str = "day, hours, minutes and seconds match";
- break;
-
- default:
- alarm_str = "invalid";
- break;
- }
-
- return sprintf(buf, "%s\n", alarm_str);
-}
-
-static DEVICE_ATTR(alarm_mode, S_IRUGO, ds1343_show_alarmmode, NULL);
-
static ssize_t ds1343_show_tricklecharger(struct device *dev,
struct device_attribute *attr, char *buf)
{
@@ -313,7 +245,6 @@ static DEVICE_ATTR(trickle_charger, S_IRUGO, ds1343_show_tricklecharger, NULL);
static int ds1343_sysfs_register(struct device *dev)
{
- struct ds1343_priv *priv = dev_get_drvdata(dev);
int err;
err = device_create_file(dev, &dev_attr_glitch_filter);
@@ -325,26 +256,9 @@ static int ds1343_sysfs_register(struct device *dev)
goto error1;
err = device_create_bin_file(dev, &nvram_attr);
- if (err)
- goto error2;
-
- if (priv->irq <= 0)
- return err;
-
- err = device_create_file(dev, &dev_attr_alarm_mode);
- if (err)
- goto error3;
-
- err = device_create_file(dev, &dev_attr_alarm_status);
if (!err)
- return err;
-
- device_remove_file(dev, &dev_attr_alarm_mode);
-
-error3:
- device_remove_bin_file(dev, &nvram_attr);
+ return 0;
-error2:
device_remove_file(dev, &dev_attr_trickle_charger);
error1:
@@ -355,17 +269,9 @@ static int ds1343_sysfs_register(struct device *dev)
static void ds1343_sysfs_unregister(struct device *dev)
{
- struct ds1343_priv *priv = dev_get_drvdata(dev);
-
device_remove_file(dev, &dev_attr_glitch_filter);
device_remove_file(dev, &dev_attr_trickle_charger);
device_remove_bin_file(dev, &nvram_attr);
-
- if (priv->irq <= 0)
- return;
-
- device_remove_file(dev, &dev_attr_alarm_status);
- device_remove_file(dev, &dev_attr_alarm_mode);
}
static int ds1343_read_time(struct device *dev, struct rtc_time *dt)
--
2.16.1
next prev parent reply other threads:[~2018-02-12 22:48 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-12 22:47 [PATCH 00/45] RTC: nvmem improvements Alexandre Belloni
2018-02-12 22:47 ` [PATCH 01/45] rtc: documentation: correct nvmem date and version Alexandre Belloni
2018-02-12 22:47 ` [PATCH 02/45] rtc: nvmem: pass nvmem_config to rtc_nvmem_register() Alexandre Belloni
2018-02-12 22:47 ` [PATCH 03/45] rtc: nvmem: return error values Alexandre Belloni
2018-02-12 22:47 ` [PATCH 04/45] rtc: nvmem: disallow registering nvmem more than once Alexandre Belloni
2018-02-12 22:47 ` [PATCH 05/45] rtc: export rtc_nvmem_register() to drivers Alexandre Belloni
2018-02-12 22:47 ` [PATCH 06/45] rtc: ds1305: call rtc_nvmem_register() Alexandre Belloni
2018-02-12 22:47 ` [PATCH 07/45] rtc: ds1305: put ds1305_nvmem_cfg on the stack Alexandre Belloni
2018-02-12 22:47 ` [PATCH 08/45] rtc: ds1307: call rtc_nvmem_register() Alexandre Belloni
2018-02-12 22:47 ` [PATCH 09/45] rtc: ds1307: put struct nvmem_config on the stack Alexandre Belloni
2018-02-12 22:47 ` [PATCH 10/45] rtc: ds1511: call rtc_nvmem_register() Alexandre Belloni
2018-02-12 22:47 ` [PATCH 11/45] rtc: ds1511: put ds1511_nvmem_cfg on the stack Alexandre Belloni
2018-02-12 22:47 ` [PATCH 12/45] rtc: m48t86: call rtc_nvmem_register() Alexandre Belloni
2018-02-12 22:47 ` [PATCH 13/45] rtc: m48t86: put m48t86_nvmem_cfg on the stack Alexandre Belloni
2018-02-12 22:47 ` [PATCH 14/45] rtc: omap: call rtc_nvmem_register() Alexandre Belloni
2018-02-12 22:47 ` [PATCH 15/45] rtc: pcf85363: " Alexandre Belloni
2018-02-12 22:47 ` [PATCH 16/45] rtc: pcf85363: put struct nvmem_config on the stack Alexandre Belloni
2018-02-12 22:47 ` [PATCH 17/45] rtc: rv8803: call rtc_nvmem_register() Alexandre Belloni
2018-02-12 22:47 ` [PATCH 18/45] rtc: rv8803: put struct nvmem_config on the stack Alexandre Belloni
2018-02-12 22:47 ` [PATCH 19/45] rtc: rv8803: fix possible race condition Alexandre Belloni
2018-02-12 22:47 ` [PATCH 20/45] rtc: remove nvmem_config Alexandre Belloni
2018-02-12 22:47 ` [PATCH 21/45] rtc: ds1343: simplify regmap initialization Alexandre Belloni
2018-02-12 22:47 ` [PATCH 22/45] rtc: ds1343: switch to rtc_register_device Alexandre Belloni
2018-02-12 22:47 ` Alexandre Belloni [this message]
2018-02-12 22:47 ` [PATCH 24/45] rtc: ds1343: use generic nvmem Alexandre Belloni
2018-02-12 22:47 ` [PATCH 25/45] rtc: m48t59: switch to rtc_register_device Alexandre Belloni
2018-02-12 22:47 ` [PATCH 26/45] rtc: m48t59: use generic nvmem Alexandre Belloni
2018-02-12 22:47 ` [PATCH 27/45] rtc: sirfsoc: remove useless sirfsoc_rtc_ioctl Alexandre Belloni
2018-02-12 22:47 ` [PATCH 28/45] rtc: ds1553: switch to rtc_register_device Alexandre Belloni
2018-02-12 22:47 ` [PATCH 29/45] rtc: ds1553: use generic nvmem Alexandre Belloni
2018-02-12 22:47 ` [PATCH 30/45] rtc: ds1553: make alarms useful Alexandre Belloni
2018-02-12 22:47 ` [PATCH 31/45] rtc: cmos: fix possible race condition Alexandre Belloni
2018-02-12 22:47 ` [PATCH 32/45] rtc: cmos: use generic nvmem Alexandre Belloni
2018-02-12 22:47 ` [PATCH 33/45] rtc: ds1742: switch to rtc_register_device Alexandre Belloni
2018-02-12 22:47 ` [PATCH 34/45] rtc: ds1742: use generic nvmem Alexandre Belloni
2018-02-12 22:47 ` [PATCH 35/45] rtc: rp5c01: fix possible race condition Alexandre Belloni
2018-02-12 22:47 ` [PATCH 36/45] rtc: rp5c01: use generic nvmem Alexandre Belloni
2018-02-12 22:47 ` [PATCH 37/45] rtc: stk17ta8: make alarms useful Alexandre Belloni
2018-02-12 22:47 ` [PATCH 38/45] rtc: stk17ta8: switch to rtc_register_device Alexandre Belloni
2018-02-12 22:47 ` [PATCH 39/45] rtc: stk17ta8: fix possible race condition Alexandre Belloni
2018-02-12 22:47 ` [PATCH 40/45] rtc: stk17ta8: use generic nvmem Alexandre Belloni
2018-02-12 22:47 ` [PATCH 41/45] rtc: tx4939: remove arch/mips dependency Alexandre Belloni
2018-02-12 22:47 ` [PATCH 42/45] rtc: tx4939: extend test coverage Alexandre Belloni
2018-02-12 22:47 ` [PATCH 43/45] rtc: tx4939: switch to rtc_register_device Alexandre Belloni
2018-02-12 22:47 ` [PATCH 44/45] rtc: tx4939: fix possible race condition Alexandre Belloni
2018-02-12 22:47 ` [PATCH 45/45] rtc: tx4939: use generic nvmem Alexandre Belloni
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=20180212224759.15999-24-alexandre.belloni@bootlin.com \
--to=alexandre.belloni@bootlin.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
/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
all inboxes | Powered by JetHome®