linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rtc: ds1305: use to_spi_device and kobj_to_dev
@ 2015-12-23 12:54 Geliang Tang
  2016-01-20 23:19 ` Alexandre Belloni
  0 siblings, 1 reply; 2+ messages in thread
From: Geliang Tang @ 2015-12-23 12:54 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni; +Cc: Geliang Tang, rtc-linux, linux-kernel

For better readability, use to_spi_device() and kobj_to_dev() instead
of container_of().

Signed-off-by: Geliang Tang <geliangtang@163.com>
---
 drivers/rtc/rtc-ds1305.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-ds1305.c b/drivers/rtc/rtc-ds1305.c
index f39691e..8e41c46 100644
--- a/drivers/rtc/rtc-ds1305.c
+++ b/drivers/rtc/rtc-ds1305.c
@@ -532,7 +532,7 @@ ds1305_nvram_read(struct file *filp, struct kobject *kobj,
 	struct spi_transfer	x[2];
 	int			status;
 
-	spi = container_of(kobj, struct spi_device, dev.kobj);
+	spi = to_spi_device(kobj_to_dev(kobj));
 
 	addr = DS1305_NVRAM + off;
 	msg_init(&m, x, &addr, count, NULL, buf);
@@ -554,7 +554,7 @@ ds1305_nvram_write(struct file *filp, struct kobject *kobj,
 	struct spi_transfer	x[2];
 	int			status;
 
-	spi = container_of(kobj, struct spi_device, dev.kobj);
+	spi = to_spi_device(kobj_to_dev(kobj));
 
 	addr = (DS1305_WRITE | DS1305_NVRAM) + off;
 	msg_init(&m, x, &addr, count, buf, NULL);
-- 
2.5.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] rtc: ds1305: use to_spi_device and kobj_to_dev
  2015-12-23 12:54 [PATCH] rtc: ds1305: use to_spi_device and kobj_to_dev Geliang Tang
@ 2016-01-20 23:19 ` Alexandre Belloni
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Belloni @ 2016-01-20 23:19 UTC (permalink / raw)
  To: Geliang Tang; +Cc: Alessandro Zummo, rtc-linux, linux-kernel

On 23/12/2015 at 20:54:33 +0800, Geliang Tang wrote :
> For better readability, use to_spi_device() and kobj_to_dev() instead
> of container_of().
> 
> Signed-off-by: Geliang Tang <geliangtang@163.com>
> ---
>  drivers/rtc/rtc-ds1305.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
Applied, thanks.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-01-20 23:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-23 12:54 [PATCH] rtc: ds1305: use to_spi_device and kobj_to_dev Geliang Tang
2016-01-20 23:19 ` 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).