summaryrefslogtreecommitdiff
path: root/drivers/rtc/rtc-s35390a.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-09-22 11:05:43 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2019-09-22 11:05:43 -0700
commit9dbd83f665298c9dcf647f20d6d6488e9019114b (patch)
tree538712c8f87137989743b22fb4a4ad4345e80572 /drivers/rtc/rtc-s35390a.c
parent379bb045171dea3e2ee01b32fe88f2afe1fe2fa8 (diff)
parentb99a3120f9a30e1429d8d634e18da8dff93340c6 (diff)
Merge tag 'rtc-5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux
Pull RTC updates from Alexandre Belloni: "Two new drivers and the new pcf2127 feature make the bulk of the additions. The rest are the usual fixes and new features. Subsystem: - add debug message when registration fails New drivers: - Amlogic Virtual Wake - Freescale FlexTimer Module alarm Drivers: - remove superfluous error messages - convert to i2c_new_dummy_device and devm_i2c_new_dummy_device - Remove dev_err() usage after platform_get_irq() - Set RTC range for: pcf2123, pcf8563, snvs. - pcf2127: tamper detection and watchdog support - pcf85363: fix regmap issue - sun6i: H6 support - remove w90x900/nuc900 driver" * tag 'rtc-5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (51 commits) rtc: meson: mark PM functions as __maybe_unused rtc: sc27xx: Remove clearing SPRD_RTC_POWEROFF_ALM_FLAG flag dt-bindings: rtc: ds1307: add rx8130 compatible rtc: sun6i: Allow using as wakeup source from suspend rtc: pcf8563: let the core handle range offsetting rtc: pcf8563: remove useless indirection rtc: pcf8563: convert to devm_rtc_allocate_device rtc: pcf8563: add Microcrystal RV8564 compatible rtc: pcf8563: add Epson RTC8564 compatible rtc: s35390a: convert to devm_i2c_new_dummy_device() rtc: max77686: convert to devm_i2c_new_dummy_device() rtc: pcf85363/pcf85263: fix regmap error in set_time rtc: snvs: switch to rtc_time64_to_tm/rtc_tm_to_time64 rtc: snvs: set range rtc: snvs: fix possible race condition rtc: pcf2127: bugfix: watchdog build dependency rtc: pcf2127: add tamper detection support rtc: pcf2127: add watchdog feature support rtc: pcf2127: bugfix: read rtc disables watchdog rtc: pcf2127: cleanup register and bit defines ...
Diffstat (limited to 'drivers/rtc/rtc-s35390a.c')
-rw-r--r--drivers/rtc/rtc-s35390a.c56
1 files changed, 14 insertions, 42 deletions
diff --git a/drivers/rtc/rtc-s35390a.c b/drivers/rtc/rtc-s35390a.c
index 84806ff763cf..da34cfd70f95 100644
--- a/drivers/rtc/rtc-s35390a.c
+++ b/drivers/rtc/rtc-s35390a.c
@@ -434,37 +434,32 @@ static int s35390a_probe(struct i2c_client *client,
char buf, status1;
struct device *dev = &client->dev;
- if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
- err = -ENODEV;
- goto exit;
- }
+ if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
+ return -ENODEV;
s35390a = devm_kzalloc(dev, sizeof(struct s35390a), GFP_KERNEL);
- if (!s35390a) {
- err = -ENOMEM;
- goto exit;
- }
+ if (!s35390a)
+ return -ENOMEM;
s35390a->client[0] = client;
i2c_set_clientdata(client, s35390a);
/* This chip uses multiple addresses, use dummy devices for them */
for (i = 1; i < 8; ++i) {
- s35390a->client[i] = i2c_new_dummy(client->adapter,
- client->addr + i);
- if (!s35390a->client[i]) {
+ s35390a->client[i] = devm_i2c_new_dummy_device(dev,
+ client->adapter,
+ client->addr + i);
+ if (IS_ERR(s35390a->client[i])) {
dev_err(dev, "Address %02x unavailable\n",
client->addr + i);
- err = -EBUSY;
- goto exit_dummy;
+ return PTR_ERR(s35390a->client[i]);
}
}
err_read = s35390a_read_status(s35390a, &status1);
if (err_read < 0) {
- err = err_read;
dev_err(dev, "error resetting chip\n");
- goto exit_dummy;
+ return err_read;
}
if (status1 & S35390A_FLAG_24H)
@@ -478,13 +473,13 @@ static int s35390a_probe(struct i2c_client *client,
err = s35390a_set_reg(s35390a, S35390A_CMD_STATUS2, &buf, 1);
if (err < 0) {
dev_err(dev, "error disabling alarm");
- goto exit_dummy;
+ return err;
}
} else {
err = s35390a_disable_test_mode(s35390a);
if (err < 0) {
dev_err(dev, "error disabling test mode\n");
- goto exit_dummy;
+ return err;
}
}
@@ -493,10 +488,8 @@ static int s35390a_probe(struct i2c_client *client,
s35390a->rtc = devm_rtc_device_register(dev, s35390a_driver.driver.name,
&s35390a_rtc_ops, THIS_MODULE);
- if (IS_ERR(s35390a->rtc)) {
- err = PTR_ERR(s35390a->rtc);
- goto exit_dummy;
- }
+ if (IS_ERR(s35390a->rtc))
+ return PTR_ERR(s35390a->rtc);
/* supports per-minute alarms only, therefore set uie_unsupported */
s35390a->rtc->uie_unsupported = 1;
@@ -505,26 +498,6 @@ static int s35390a_probe(struct i2c_client *client,
rtc_update_irq(s35390a->rtc, 1, RTC_AF);
return 0;
-
-exit_dummy:
- for (i = 1; i < 8; ++i)
- if (s35390a->client[i])
- i2c_unregister_device(s35390a->client[i]);
-
-exit:
- return err;
-}
-
-static int s35390a_remove(struct i2c_client *client)
-{
- unsigned int i;
- struct s35390a *s35390a = i2c_get_clientdata(client);
-
- for (i = 1; i < 8; ++i)
- if (s35390a->client[i])
- i2c_unregister_device(s35390a->client[i]);
-
- return 0;
}
static struct i2c_driver s35390a_driver = {
@@ -533,7 +506,6 @@ static struct i2c_driver s35390a_driver = {
.of_match_table = of_match_ptr(s35390a_of_match),
},
.probe = s35390a_probe,
- .remove = s35390a_remove,
.id_table = s35390a_id,
};