Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp668207imm; Fri, 28 Sep 2018 05:02:12 -0700 (PDT) X-Google-Smtp-Source: ACcGV61Y6Wh5nmZlRAH7knaVmEdScw899IVkbYs+atUScrvD2WyadW3+jIfBy465QF7SblvKbIfL X-Received: by 2002:a62:938e:: with SMTP id r14-v6mr16700215pfk.55.1538136131931; Fri, 28 Sep 2018 05:02:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538136131; cv=none; d=google.com; s=arc-20160816; b=fbVVwif7sR9P6oz6AeL8kpGuZeXH128iyMy+VNK94Uzdh7bWNuz3P025nMfJ/1AsRm 7DRMN15p3EinzBB4gRvEUidVNwQob8ZLhI7xTMYDvwIvetDgH4Jca9X1nLuuHmpVwcMD uj0U9Qli6vNQSVZMzfq02F73LeArEIWgA6B3KT2AiOFYsMb5vLzn65p+P5yJmK0P6qOv /0el/EB4ueE8/fQ9DOWK543Zz5VTpvm5UzVIT+Kn4yBYK2HVRkA+fod8jaZg//NsHK2X 0nWrWCCXamNYrm5L/dXCDycdrY0PkXgAT35Q90kXv0v6FsQN+8//E93PV1lVjQLJRXLu tXnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:message-id:date:thread-index :thread-topic:subject:cc:to:from; bh=EutpymVQG0EMzd0iqOzJmqgWUIo9Rpno0nqe/s4hNJI=; b=ZtIuah9aFyyM61dHp1JyKVDqUYWI4zM2Ya1GCpY1asmyI4RO60FxJrxDqIjL040hu/ cBOoKsA7Bqj8wRvk9FRBLsRrY8GwIuAlKOZ9pqklK2SNgU6V4EqcBI7jGZP6ARb6iZHe DFlBcll/tcHpZcZ7v24L+d8N9NQQUQnYLx+6mO0KinIc8cQLE/0fev8dh/6Y7spRkDGc A1xWok8IvuNFNrnjSzax7J37/LHWk5pRcUkFiZhHEW1Zmyxf3OujZxidddAE8/cw7Cqy KE0s1cNkZLcXVael3vQPZTos30HLMEm6SAiY/jkMyRrvpS5lCrtyiOKeHW7cS2hr7pla hZDA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f13-v6si4572718pgm.676.2018.09.28.05.01.55; Fri, 28 Sep 2018 05:02:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727870AbeI1SYg convert rfc822-to-8bit (ORCPT + 99 others); Fri, 28 Sep 2018 14:24:36 -0400 Received: from enterprise02.smtp.diehl.com ([193.201.238.220]:14264 "EHLO enterprise02.smtp.diehl.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726024AbeI1SYg (ORCPT ); Fri, 28 Sep 2018 14:24:36 -0400 X-Greylist: delayed 591 seconds by postgrey-1.27 at vger.kernel.org; Fri, 28 Sep 2018 14:24:35 EDT X-$ESA-Groupmapping: true X-IronPort-AV: E=Sophos;i="5.54,314,1534802400"; d="scan'208";a="36654630" From: Denis OSTERLAND To: "a.zummo@towertech.it" , "alexandre.belloni@bootlin.com" CC: "linux-rtc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Denis OSTERLAND" Subject: [PATCH] rtc: isl1208: access i2c client via rtc parent Thread-Topic: [PATCH] rtc: isl1208: access i2c client via rtc parent Thread-Index: AQHUVyGQKP+USsTTMEa4uID7TSMNXQ== Date: Fri, 28 Sep 2018 11:51:17 +0000 Message-ID: <20180928114832.27383-1-Denis.Osterland@diehl.com> Accept-Language: de-DE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: Evolution 3.18.5.2-0ubuntu3.2 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-TrailerSkip: 1 X-GBS-PROC: 415AWy8o668fDtCxszluzyTxtule2fzpl/mNt4bSsMHQALdi8BOj7OdbdMtiUqvX Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Denis Osterland 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 --- 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.