Skip to contentSkip to conversation

rtc: pcf85363: remove unused struct pcf85363 member

PATCH In review Alexandre Belloni 2 participants 7 messages Apr 10, 2019 Real time clock (RTC)

lore
Share & tools
lore

Alexandre Belloni

author maintainer
#0 lore raw

PATCH 1/5 rtc: pcf85363: remove unused struct pcf85363 member

pcf85363->dev is unused, remove it.

---
 drivers/rtc/rtc-pcf85363.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/rtc/rtc-pcf85363.c +2 -4
index a3988079f60a..3905c0ad9d83 100644
@@ -115,7 +115,6 @@
 static struct i2c_driver pcf85363_driver;
 
 struct pcf85363 {
-	struct device		*dev;
 	struct rtc_device	*rtc;
 	struct regmap		*regmap;
 };
@@ -400,10 +399,9 @@ static int pcf85363_probe(struct i2c_client *client,
 		return PTR_ERR(pcf85363->regmap);
 	}
 
-	pcf85363->dev = &client->dev;
 	i2c_set_clientdata(client, pcf85363);
 
-	pcf85363->rtc = devm_rtc_allocate_device(pcf85363->dev);
+	pcf85363->rtc = devm_rtc_allocate_device(&client->dev);
 	if (IS_ERR(pcf85363->rtc))
 		return PTR_ERR(pcf85363->rtc);
 
@@ -413,7 +411,7 @@ static int pcf85363_probe(struct i2c_client *client,
 		regmap_write(pcf85363->regmap, CTRL_FLAGS, 0);
 		regmap_update_bits(pcf85363->regmap, CTRL_PIN_IO,
 				   PIN_IO_INTA_OUT, PIN_IO_INTAPM);
-		ret = devm_request_threaded_irq(pcf85363->dev, client->irq,
+		ret = devm_request_threaded_irq(&client->dev, client->irq,
 						NULL, pcf85363_rtc_handle_irq,
 						IRQF_TRIGGER_LOW | IRQF_ONESHOT,
 						"pcf85363", client);
Signature · 1 line
2.20.1
author maintainer
#1 lore raw

PATCH 2/5 rtc: pcf85363: set range

This is a standard BCD RTC that will fail in 2100.

---
 drivers/rtc/rtc-pcf85363.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/rtc/rtc-pcf85363.c +2 -0
index 3905c0ad9d83..8d538a253d72 100644
@@ -406,6 +406,8 @@ static int pcf85363_probe(struct i2c_client *client,
 		return PTR_ERR(pcf85363->rtc);
 
 	pcf85363->rtc->ops = &rtc_ops;
+	pcf85363->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
+	pcf85363->rtc->range_max = RTC_TIMESTAMP_END_2099;
 
 	if (client->irq > 0) {
 		regmap_write(pcf85363->regmap, CTRL_FLAGS, 0);
Signature · 1 line
2.20.1
author maintainer
#2 lore raw

PATCH 3/5 rtc: pcf85363: remove bogus i2c functionality check

In reply to Alexandre Belloni

regmap is abstracting the i2c functionalities the best it can, there is no need to check.

---
 drivers/rtc/rtc-pcf85363.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/rtc/rtc-pcf85363.c +0 -3
index 8d538a253d72..5e369846795e 100644
@@ -385,9 +385,6 @@ static int pcf85363_probe(struct i2c_client *client,
 	if (data)
 		config = data;
 
-	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
-		return -ENODEV;
-
 	pcf85363 = devm_kzalloc(&client->dev, sizeof(struct pcf85363),
 				GFP_KERNEL);
 	if (!pcf85363)
Signature · 1 line
2.20.1
author maintainer
#3 lore raw

PATCH 4/5 rtc: pcf85363: remove useless forward declaration

In reply to Alexandre Belloni

It is not necessary to forward declare pcf85363_driver as it is not used before being declared.

---
 drivers/rtc/rtc-pcf85363.c | 2 --
 1 file changed, 2 deletions(-)
drivers/rtc/rtc-pcf85363.c +0 -2
index 5e369846795e..afb1baacdaa7 100644
@@ -112,8 +112,6 @@
 
 #define NVRAM_SIZE	0x40
 
-static struct i2c_driver pcf85363_driver;
-
 struct pcf85363 {
 	struct rtc_device	*rtc;
 	struct regmap		*regmap;
Signature · 1 line
2.20.1
author maintainer
#4 lore raw

PATCH 5/5 rtc: pcf85363: convert to SPDX identifier

In reply to Alexandre Belloni

Use SPDX-License-Identifier instead of a verbose license text.

The original text refers to version 2 so also update MODULE_LICENSE() to "GPL v2" instead of "GPL".

---
 drivers/rtc/rtc-pcf85363.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/rtc/rtc-pcf85363.c +1 -6
index afb1baacdaa7..a075e77617dc 100644
@@ -1,15 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * drivers/rtc/rtc-pcf85363.c
  *
  * Driver for NXP PCF85363 real-time clock.
  *
  * Copyright (C) 2017 Eric Nelson
- *
- * 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.
- *
- * Based loosely on rtc-8583 by Russell King, Wolfram Sang and Juergen Beisert
  */
 #include <linux/module.h>
 #include <linux/i2c.h>
Signature · 1 line
2.20.1
#5 lore raw

Re: [PATCH 5/5] rtc: pcf85363: convert to SPDX identifier

Quoted 22 lines · Alexandre Belloni

Use SPDX-License-Identifier instead of a verbose license text.

The original text refers to version 2 so also update MODULE_LICENSE() to "GPL v2" instead of "GPL".

---
  drivers/rtc/rtc-pcf85363.c | 7 +------
  1 file changed, 1 insertion(+), 6 deletions(-)
drivers/rtc/rtc-pcf85363.c +1 -0
index afb1baacdaa7..a075e77617dc 100644
@@ -1,15 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0
  /*
   * drivers/rtc/rtc-pcf85363.c
   *
   * Driver for NXP PCF85363 real-time clock.
   *

drivers/rtc/rtc-pcf85363.c line 10

Quoted 10 lines
drivers/rtc/rtc-pcf85363.c +0 -6
   * Copyright (C) 2017 Eric Nelson
- *
- * 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.
- *
- * Based loosely on rtc-8583 by Russell King, Wolfram Sang and Juergen Beisert
   */
  #include <linux/module.h>
  #include <linux/i2c.h>

Looks like you did not update MODULE_LICENSE as stated in the comment?

Signature · 3 lines
Brandon Martin
Mothic Technologies
317-565-1357 x7000
author maintainer
#6 lore raw

Re: [PATCH 5/5] rtc: pcf85363: convert to SPDX identifier

Quoted 27 lines · Brandon Martin
Quoted 26 lines · Alexandre Belloni

Use SPDX-License-Identifier instead of a verbose license text.

The original text refers to version 2 so also update MODULE_LICENSE() to "GPL v2" instead of "GPL".

---
  drivers/rtc/rtc-pcf85363.c | 7 +------
  1 file changed, 1 insertion(+), 6 deletions(-)
drivers/rtc/rtc-pcf85363.c +1 -4
index afb1baacdaa7..a075e77617dc 100644
@@ -1,15 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0
  /*
   * drivers/rtc/rtc-pcf85363.c
   *
   * Driver for NXP PCF85363 real-time clock.
   *
   * Copyright (C) 2017 Eric Nelson
- *
- * 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.
Quoted 8 lines

drivers/rtc/rtc-pcf85363.c line 10

Quoted 6 lines
drivers/rtc/rtc-pcf85363.c +0 -2
- *
- * Based loosely on rtc-8583 by Russell King, Wolfram Sang and Juergen Beisert
   */
  #include <linux/module.h>
  #include <linux/i2c.h>

Looks like you did not update MODULE_LICENSE as stated in the comment?

Right, I'll remove that from the commit message.

Thanks!

Signature · 3 lines
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com