* [PATCH] rtc: isl1208: access i2c client via rtc parent
@ 2018-09-28 11:51 Denis OSTERLAND
2018-09-28 12:04 ` Alexandre Belloni
0 siblings, 1 reply; 4+ messages in thread
From: Denis OSTERLAND @ 2018-09-28 11:51 UTC (permalink / raw)
To: a.zummo@towertech.it, alexandre.belloni@bootlin.com
Cc: linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org,
Denis OSTERLAND
From: Denis Osterland <Denis.Osterland@diehl.com>
The move of atrim, dtrim usr sysfs properties from i2c device
to rtc device require to access them via dev->parent.
This patch also aligns timestamp0.
Fixes: 03df75dd03301307ec578ccd4e8c1c0117b8e65c
Signed-off-by: Denis Osterland <Denis.Osterland@diehl.com>
---
drivers/rtc/rtc-isl1208.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c
index 15094df12985..ec5ef518a09b 100644
--- a/drivers/rtc/rtc-isl1208.c
+++ b/drivers/rtc/rtc-isl1208.c
@@ -517,7 +517,7 @@ static ssize_t timestamp0_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
- struct i2c_client *client = dev_get_drvdata(dev);
+ struct i2c_client *client = to_i2c_client(dev->parent);
int sr;
sr = isl1208_i2c_get_sr(client);
@@ -539,7 +539,7 @@ static ssize_t timestamp0_store(struct device *dev,
static ssize_t timestamp0_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
- struct i2c_client *client = dev_get_drvdata(dev);
+ struct i2c_client *client = to_i2c_client(dev->parent);
u8 regs[ISL1219_EVT_SECTION_LEN] = { 0, };
struct rtc_time tm;
int sr;
@@ -649,7 +649,7 @@ static ssize_t
isl1208_sysfs_show_atrim(struct device *dev,
struct device_attribute *attr, char *buf)
{
- int atr = isl1208_i2c_get_atr(to_i2c_client(dev));
+ int atr = isl1208_i2c_get_atr(to_i2c_client(dev->parent));
if (atr < 0)
return atr;
@@ -662,7 +662,7 @@ static ssize_t
isl1208_sysfs_show_dtrim(struct device *dev,
struct device_attribute *attr, char *buf)
{
- int dtr = isl1208_i2c_get_dtr(to_i2c_client(dev));
+ int dtr = isl1208_i2c_get_dtr(to_i2c_client(dev->parent));
if (dtr < 0)
return dtr;
@@ -675,7 +675,7 @@ static ssize_t
isl1208_sysfs_show_usr(struct device *dev,
struct device_attribute *attr, char *buf)
{
- int usr = isl1208_i2c_get_usr(to_i2c_client(dev));
+ int usr = isl1208_i2c_get_usr(to_i2c_client(dev->parent));
if (usr < 0)
return usr;
@@ -700,7 +700,10 @@ isl1208_sysfs_store_usr(struct device *dev,
if (usr < 0 || usr > 0xffff)
return -EINVAL;
- return isl1208_i2c_set_usr(to_i2c_client(dev), usr) ? -EIO : count;
+ if (isl1208_i2c_set_usr(to_i2c_client(dev->parent), usr))
+ return -EIO;
+
+ return count;
}
static DEVICE_ATTR(usr, S_IRUGO | S_IWUSR, isl1208_sysfs_show_usr,
@@ -764,7 +767,6 @@ isl1208_probe(struct i2c_client *client, const struct i2c_device_id *id)
rtc->ops = &isl1208_rtc_ops;
i2c_set_clientdata(client, rtc);
- dev_set_drvdata(&rtc->dev, client);
rc = isl1208_i2c_get_sr(client);
if (rc < 0) {
--
2.19.0
Diehl Connectivity Solutions GmbH
Geschäftsführung: Horst Leonberger
Sitz der Gesellschaft: Nürnberg - Registergericht: Amtsgericht
Nürnberg: HRB 32315
___________________________________________________________________________________________________
Der Inhalt der vorstehenden E-Mail ist nicht rechtlich bindend. Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte Informationen.
Informieren Sie uns bitte, wenn Sie diese E-Mail faelschlicherweise erhalten haben. Bitte loeschen Sie in diesem Fall die Nachricht.
Jede unerlaubte Form der Reproduktion, Bekanntgabe, Aenderung, Verteilung und/oder Publikation dieser E-Mail ist strengstens untersagt.
The contents of the above mentioned e-mail is not legally binding. This e-mail contains confidential and/or legally protected information. Please inform us if you have received this e-mail by
mistake and delete it in such a case. Each unauthorized reproduction, disclosure, alteration, distribution and/or publication of this e-mail is strictly prohibited.
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] rtc: isl1208: access i2c client via rtc parent
2018-09-28 11:51 [PATCH] rtc: isl1208: access i2c client via rtc parent Denis OSTERLAND
@ 2018-09-28 12:04 ` Alexandre Belloni
2018-09-28 12:06 ` Denis OSTERLAND
0 siblings, 1 reply; 4+ messages in thread
From: Alexandre Belloni @ 2018-09-28 12:04 UTC (permalink / raw)
To: Denis OSTERLAND
Cc: a.zummo@towertech.it, linux-rtc@vger.kernel.org,
linux-kernel@vger.kernel.org
Hello,
On 28/09/2018 11:51:17+0000, Denis OSTERLAND wrote:
> From: Denis Osterland <Denis.Osterland@diehl.com>
>
> The move of atrim, dtrim usr sysfs properties from i2c device
> to rtc device require to access them via dev->parent.
> This patch also aligns timestamp0.
>
> Fixes: 03df75dd03301307ec578ccd4e8c1c0117b8e65c
> Signed-off-by: Denis Osterland <Denis.Osterland@diehl.com>
> ---
> drivers/rtc/rtc-isl1208.c | 16 +++++++++-------
> 1 file changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c
> index 15094df12985..ec5ef518a09b 100644
> --- a/drivers/rtc/rtc-isl1208.c
> +++ b/drivers/rtc/rtc-isl1208.c
> @@ -517,7 +517,7 @@ static ssize_t timestamp0_store(struct device *dev,
> struct device_attribute *attr,
> const char *buf, size_t count)
> {
> - struct i2c_client *client = dev_get_drvdata(dev);
> + struct i2c_client *client = to_i2c_client(dev->parent);
> int sr;
>
> sr = isl1208_i2c_get_sr(client);
> @@ -539,7 +539,7 @@ static ssize_t timestamp0_store(struct device *dev,
> static ssize_t timestamp0_show(struct device *dev,
> struct device_attribute *attr, char *buf)
> {
> - struct i2c_client *client = dev_get_drvdata(dev);
> + struct i2c_client *client = to_i2c_client(dev->parent);
> u8 regs[ISL1219_EVT_SECTION_LEN] = { 0, };
> struct rtc_time tm;
> int sr;
> @@ -649,7 +649,7 @@ static ssize_t
> isl1208_sysfs_show_atrim(struct device *dev,
> struct device_attribute *attr, char *buf)
> {
> - int atr = isl1208_i2c_get_atr(to_i2c_client(dev));
> + int atr = isl1208_i2c_get_atr(to_i2c_client(dev->parent));
> if (atr < 0)
> return atr;
>
> @@ -662,7 +662,7 @@ static ssize_t
> isl1208_sysfs_show_dtrim(struct device *dev,
> struct device_attribute *attr, char *buf)
> {
> - int dtr = isl1208_i2c_get_dtr(to_i2c_client(dev));
> + int dtr = isl1208_i2c_get_dtr(to_i2c_client(dev->parent));
Oh right, I actually had that but somehow, I stashed the patch instead
of squashing it.
If that is fine for you, I'll fold that in the original patch (I'll ad
your SoB).
--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] rtc: isl1208: access i2c client via rtc parent
2018-09-28 12:04 ` Alexandre Belloni
@ 2018-09-28 12:06 ` Denis OSTERLAND
2018-09-28 12:12 ` Alexandre Belloni
0 siblings, 1 reply; 4+ messages in thread
From: Denis OSTERLAND @ 2018-09-28 12:06 UTC (permalink / raw)
To: alexandre.belloni@bootlin.com
Cc: linux-rtc@vger.kernel.org, a.zummo@towertech.it,
linux-kernel@vger.kernel.org
QW0gRnJlaXRhZywgZGVuIDI4LjA5LjIwMTgsIDE0OjA0ICswMjAwIHNjaHJpZWIgQWxleGFu
ZHJlIEJlbGxvbmk6DQo+IEhlbGxvLA0KPsKgDQo+IE9oIHJpZ2h0LCBJIGFjdHVhbGx5IGhh
ZCB0aGF0IGJ1dCBzb21laG93LCBJIHN0YXNoZWQgdGhlIHBhdGNoIGluc3RlYWQNCj4gb2Yg
c3F1YXNoaW5nIGl0Lg0KPiANCj4gSWYgdGhhdCBpcyBmaW5lIGZvciB5b3UsIEknbGwgZm9s
ZCB0aGF0IGluIHRoZSBvcmlnaW5hbCBwYXRjaCAoSSdsbCBhZA0KPiB5b3VyIFNvQikuDQo+
IA0KPiANClNvdW5k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IGNv
bmZpZGVudGlhbCBhbmQvb3IgbGVnYWxseSBwcm90ZWN0ZWQgaW5mb3JtYXRpb24uIFBsZWFz
ZSBpbmZvcm0gdXMgaWYgeW91IGhhdmUgcmVjZWl2ZWQgdGhpcyBlLW1haWwgYnkNCm1pc3Rh
a2UgYW5kIGRlbGV0ZSBpdCBpbiBzdWNoIGEgY2FzZS4gRWFjaCB1bmF1dGhvcml6ZWQgcmVw
cm9kdWN0aW9uLCBkaXNjbG9zdXJlLCBhbHRlcmF0aW9uLCBkaXN0cmlidXRpb24gYW5kL29y
IHB1YmxpY2F0aW9uIG9mIHRoaXMgZS1tYWlsIGlzIHN0cmljdGx5IHByb2hpYml0ZWQuIA0K
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] rtc: isl1208: access i2c client via rtc parent
2018-09-28 12:06 ` Denis OSTERLAND
@ 2018-09-28 12:12 ` Alexandre Belloni
0 siblings, 0 replies; 4+ messages in thread
From: Alexandre Belloni @ 2018-09-28 12:12 UTC (permalink / raw)
To: Denis OSTERLAND
Cc: linux-rtc@vger.kernel.org, a.zummo@towertech.it,
linux-kernel@vger.kernel.org
On 28/09/2018 12:06:27+0000, Denis OSTERLAND wrote:
> Am Freitag, den 28.09.2018, 14:04 +0200 schrieb Alexandre Belloni:
> > Hello,
> >
> > Oh right, I actually had that but somehow, I stashed the patch instead
> > of squashing it.
> >
> > If that is fine for you, I'll fold that in the original patch (I'll ad
> > your SoB).
> >
> >
> Sounds good.
>
Thanks again !
--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-09-28 18:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-28 11:51 [PATCH] rtc: isl1208: access i2c client via rtc parent Denis OSTERLAND
2018-09-28 12:04 ` Alexandre Belloni
2018-09-28 12:06 ` Denis OSTERLAND
2018-09-28 12:12 ` 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).