* [PATCH 1/5] misc: c2port: use kobj_to_dev()
@ 2016-01-13 15:30 Geliang Tang
2016-01-13 15:30 ` [PATCH 2/5] misc: cxl: " Geliang Tang
` (4 more replies)
0 siblings, 5 replies; 8+ messages in thread
From: Geliang Tang @ 2016-01-13 15:30 UTC (permalink / raw)
To: Viresh Kumar, Jiri Kosina, Arnd Bergmann, Greg Kroah-Hartman
Cc: Geliang Tang, linux-kernel
Use kobj_to_dev() instead of open-coding it.
Signed-off-by: Geliang Tang <geliangtang@163.com>
---
drivers/misc/c2port/core.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/misc/c2port/core.c b/drivers/misc/c2port/core.c
index cc8645b..1922cb8 100644
--- a/drivers/misc/c2port/core.c
+++ b/drivers/misc/c2port/core.c
@@ -721,9 +721,7 @@ static ssize_t c2port_read_flash_data(struct file *filp, struct kobject *kobj,
struct bin_attribute *attr,
char *buffer, loff_t offset, size_t count)
{
- struct c2port_device *c2dev =
- dev_get_drvdata(container_of(kobj,
- struct device, kobj));
+ struct c2port_device *c2dev = dev_get_drvdata(kobj_to_dev(kobj));
ssize_t ret;
/* Check the device and flash access status */
@@ -838,9 +836,7 @@ static ssize_t c2port_write_flash_data(struct file *filp, struct kobject *kobj,
struct bin_attribute *attr,
char *buffer, loff_t offset, size_t count)
{
- struct c2port_device *c2dev =
- dev_get_drvdata(container_of(kobj,
- struct device, kobj));
+ struct c2port_device *c2dev = dev_get_drvdata(kobj_to_dev(kobj));
int ret;
/* Check the device access status */
--
2.5.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/5] misc: cxl: use kobj_to_dev()
2016-01-13 15:30 [PATCH 1/5] misc: c2port: use kobj_to_dev() Geliang Tang
@ 2016-01-13 15:30 ` Geliang Tang
2016-01-13 21:19 ` Michael Ellerman
2016-01-13 23:00 ` Andrew Donnellan
2016-01-13 15:30 ` [PATCH 3/5] pch_phub: " Geliang Tang
` (3 subsequent siblings)
4 siblings, 2 replies; 8+ messages in thread
From: Geliang Tang @ 2016-01-13 15:30 UTC (permalink / raw)
To: Ian Munsie, Michael Neuling, Arnd Bergmann, Greg Kroah-Hartman
Cc: Geliang Tang, linuxppc-dev, linux-kernel
Use kobj_to_dev() instead of open-coding it.
Signed-off-by: Geliang Tang <geliangtang@163.com>
---
drivers/misc/cxl/sysfs.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/misc/cxl/sysfs.c b/drivers/misc/cxl/sysfs.c
index 02006f71..038af5d 100644
--- a/drivers/misc/cxl/sysfs.c
+++ b/drivers/misc/cxl/sysfs.c
@@ -386,8 +386,7 @@ static ssize_t afu_eb_read(struct file *filp, struct kobject *kobj,
struct bin_attribute *bin_attr, char *buf,
loff_t off, size_t count)
{
- struct cxl_afu *afu = to_cxl_afu(container_of(kobj,
- struct device, kobj));
+ struct cxl_afu *afu = to_cxl_afu(kobj_to_dev(kobj));
return cxl_afu_read_err_buffer(afu, buf, off, count);
}
@@ -467,7 +466,7 @@ static ssize_t afu_read_config(struct file *filp, struct kobject *kobj,
loff_t off, size_t count)
{
struct afu_config_record *cr = to_cr(kobj);
- struct cxl_afu *afu = to_cxl_afu(container_of(kobj->parent, struct device, kobj));
+ struct cxl_afu *afu = to_cxl_afu(kobj_to_dev(kobj->parent));
u64 i, j, val;
--
2.5.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/5] pch_phub: use kobj_to_dev()
2016-01-13 15:30 [PATCH 1/5] misc: c2port: use kobj_to_dev() Geliang Tang
2016-01-13 15:30 ` [PATCH 2/5] misc: cxl: " Geliang Tang
@ 2016-01-13 15:30 ` Geliang Tang
2016-01-13 15:30 ` [PATCH 4/5] misc: eeprom: " Geliang Tang
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Geliang Tang @ 2016-01-13 15:30 UTC (permalink / raw)
To: Arnd Bergmann, Greg Kroah-Hartman; +Cc: Geliang Tang, linux-kernel
Use kobj_to_dev() instead of open-coding it.
Signed-off-by: Geliang Tang <geliangtang@163.com>
---
drivers/misc/pch_phub.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/misc/pch_phub.c b/drivers/misc/pch_phub.c
index 9a17a9b..15bb0c8 100644
--- a/drivers/misc/pch_phub.c
+++ b/drivers/misc/pch_phub.c
@@ -503,8 +503,7 @@ static ssize_t pch_phub_bin_read(struct file *filp, struct kobject *kobj,
int err;
ssize_t rom_size;
- struct pch_phub_reg *chip =
- dev_get_drvdata(container_of(kobj, struct device, kobj));
+ struct pch_phub_reg *chip = dev_get_drvdata(kobj_to_dev(kobj));
ret = mutex_lock_interruptible(&pch_phub_mutex);
if (ret) {
@@ -567,8 +566,7 @@ static ssize_t pch_phub_bin_write(struct file *filp, struct kobject *kobj,
unsigned int addr_offset;
int ret;
ssize_t rom_size;
- struct pch_phub_reg *chip =
- dev_get_drvdata(container_of(kobj, struct device, kobj));
+ struct pch_phub_reg *chip = dev_get_drvdata(kobj_to_dev(kobj));
ret = mutex_lock_interruptible(&pch_phub_mutex);
if (ret)
--
2.5.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/5] misc: eeprom: use kobj_to_dev()
2016-01-13 15:30 [PATCH 1/5] misc: c2port: use kobj_to_dev() Geliang Tang
2016-01-13 15:30 ` [PATCH 2/5] misc: cxl: " Geliang Tang
2016-01-13 15:30 ` [PATCH 3/5] pch_phub: " Geliang Tang
@ 2016-01-13 15:30 ` Geliang Tang
2016-01-13 15:30 ` [PATCH 5/5] GenWQE: " Geliang Tang
2016-01-14 9:43 ` [PATCH 1/5] misc: c2port: " Viresh Kumar
4 siblings, 0 replies; 8+ messages in thread
From: Geliang Tang @ 2016-01-13 15:30 UTC (permalink / raw)
To: Wolfram Sang, Jean Delvare, Arnd Bergmann, Greg Kroah-Hartman
Cc: Geliang Tang, linux-i2c, linux-kernel
Use kobj_to_dev() instead of open-coding it.
Signed-off-by: Geliang Tang <geliangtang@163.com>
---
drivers/misc/eeprom/at24.c | 4 ++--
drivers/misc/eeprom/at25.c | 4 ++--
drivers/misc/eeprom/eeprom.c | 2 +-
drivers/misc/eeprom/eeprom_93xx46.c | 4 ++--
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index 5d7c090..d105c25 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -289,7 +289,7 @@ static ssize_t at24_bin_read(struct file *filp, struct kobject *kobj,
{
struct at24_data *at24;
- at24 = dev_get_drvdata(container_of(kobj, struct device, kobj));
+ at24 = dev_get_drvdata(kobj_to_dev(kobj));
return at24_read(at24, buf, off, count);
}
@@ -420,7 +420,7 @@ static ssize_t at24_bin_write(struct file *filp, struct kobject *kobj,
{
struct at24_data *at24;
- at24 = dev_get_drvdata(container_of(kobj, struct device, kobj));
+ at24 = dev_get_drvdata(kobj_to_dev(kobj));
return at24_write(at24, buf, off, count);
}
diff --git a/drivers/misc/eeprom/at25.c b/drivers/misc/eeprom/at25.c
index f850ef5..3e9e5a2 100644
--- a/drivers/misc/eeprom/at25.c
+++ b/drivers/misc/eeprom/at25.c
@@ -139,7 +139,7 @@ at25_bin_read(struct file *filp, struct kobject *kobj,
struct device *dev;
struct at25_data *at25;
- dev = container_of(kobj, struct device, kobj);
+ dev = kobj_to_dev(kobj);
at25 = dev_get_drvdata(dev);
return at25_ee_read(at25, buf, off, count);
@@ -273,7 +273,7 @@ at25_bin_write(struct file *filp, struct kobject *kobj,
struct device *dev;
struct at25_data *at25;
- dev = container_of(kobj, struct device, kobj);
+ dev = kobj_to_dev(kobj);
at25 = dev_get_drvdata(dev);
return at25_ee_write(at25, buf, off, count);
diff --git a/drivers/misc/eeprom/eeprom.c b/drivers/misc/eeprom/eeprom.c
index 7342fd6..3d1d551 100644
--- a/drivers/misc/eeprom/eeprom.c
+++ b/drivers/misc/eeprom/eeprom.c
@@ -84,7 +84,7 @@ static ssize_t eeprom_read(struct file *filp, struct kobject *kobj,
struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{
- struct i2c_client *client = to_i2c_client(container_of(kobj, struct device, kobj));
+ struct i2c_client *client = to_i2c_client(kobj_to_dev(kobj));
struct eeprom_data *data = i2c_get_clientdata(client);
u8 slice;
diff --git a/drivers/misc/eeprom/eeprom_93xx46.c b/drivers/misc/eeprom/eeprom_93xx46.c
index ff63f05..473aa0a 100644
--- a/drivers/misc/eeprom/eeprom_93xx46.c
+++ b/drivers/misc/eeprom/eeprom_93xx46.c
@@ -45,7 +45,7 @@ eeprom_93xx46_bin_read(struct file *filp, struct kobject *kobj,
int bits, ret;
u16 cmd_addr;
- dev = container_of(kobj, struct device, kobj);
+ dev = kobj_to_dev(kobj);
edev = dev_get_drvdata(dev);
cmd_addr = OP_READ << edev->addrlen;
@@ -190,7 +190,7 @@ eeprom_93xx46_bin_write(struct file *filp, struct kobject *kobj,
struct device *dev;
int i, ret, step = 1;
- dev = container_of(kobj, struct device, kobj);
+ dev = kobj_to_dev(kobj);
edev = dev_get_drvdata(dev);
/* only write even number of bytes on 16-bit devices */
--
2.5.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 5/5] GenWQE: use kobj_to_dev()
2016-01-13 15:30 [PATCH 1/5] misc: c2port: use kobj_to_dev() Geliang Tang
` (2 preceding siblings ...)
2016-01-13 15:30 ` [PATCH 4/5] misc: eeprom: " Geliang Tang
@ 2016-01-13 15:30 ` Geliang Tang
2016-01-14 9:43 ` [PATCH 1/5] misc: c2port: " Viresh Kumar
4 siblings, 0 replies; 8+ messages in thread
From: Geliang Tang @ 2016-01-13 15:30 UTC (permalink / raw)
To: Arnd Bergmann, Greg Kroah-Hartman; +Cc: Geliang Tang, linux-kernel
Use kobj_to_dev() instead of open-coding it.
Signed-off-by: Geliang Tang <geliangtang@163.com>
---
drivers/misc/genwqe/card_sysfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/misc/genwqe/card_sysfs.c b/drivers/misc/genwqe/card_sysfs.c
index 6ab31ef..c24c9b7 100644
--- a/drivers/misc/genwqe/card_sysfs.c
+++ b/drivers/misc/genwqe/card_sysfs.c
@@ -278,7 +278,7 @@ static umode_t genwqe_is_visible(struct kobject *kobj,
struct attribute *attr, int n)
{
unsigned int j;
- struct device *dev = container_of(kobj, struct device, kobj);
+ struct device *dev = kobj_to_dev(kobj);
struct genwqe_dev *cd = dev_get_drvdata(dev);
umode_t mode = attr->mode;
--
2.5.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/5] misc: cxl: use kobj_to_dev()
2016-01-13 15:30 ` [PATCH 2/5] misc: cxl: " Geliang Tang
@ 2016-01-13 21:19 ` Michael Ellerman
2016-01-13 23:00 ` Andrew Donnellan
1 sibling, 0 replies; 8+ messages in thread
From: Michael Ellerman @ 2016-01-13 21:19 UTC (permalink / raw)
To: Geliang Tang, Ian Munsie, Michael Neuling, Arnd Bergmann,
Greg Kroah-Hartman
Cc: linuxppc-dev, linux-kernel
On Wed, 2016-01-13 at 23:30 +0800, Geliang Tang wrote:
> Use kobj_to_dev() instead of open-coding it.
>
> Signed-off-by: Geliang Tang <geliangtang@163.com>
> ---
> drivers/misc/cxl/sysfs.c | 5 ++---
Looks fine. Do you want me to merge it or just ack it?
Acked-by: Michael Ellerman <mpe@ellerman.id.au>
cheers
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/5] misc: cxl: use kobj_to_dev()
2016-01-13 15:30 ` [PATCH 2/5] misc: cxl: " Geliang Tang
2016-01-13 21:19 ` Michael Ellerman
@ 2016-01-13 23:00 ` Andrew Donnellan
1 sibling, 0 replies; 8+ messages in thread
From: Andrew Donnellan @ 2016-01-13 23:00 UTC (permalink / raw)
To: Geliang Tang, Ian Munsie, Michael Neuling, Arnd Bergmann,
Greg Kroah-Hartman
Cc: linuxppc-dev, linux-kernel
On 14/01/16 02:30, Geliang Tang wrote:
> Use kobj_to_dev() instead of open-coding it.
>
> Signed-off-by: Geliang Tang <geliangtang@163.com>
Good simplification.
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
--
Andrew Donnellan Software Engineer, OzLabs
andrew.donnellan@au1.ibm.com Australia Development Lab, Canberra
+61 2 6201 8874 (work) IBM Australia Limited
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/5] misc: c2port: use kobj_to_dev()
2016-01-13 15:30 [PATCH 1/5] misc: c2port: use kobj_to_dev() Geliang Tang
` (3 preceding siblings ...)
2016-01-13 15:30 ` [PATCH 5/5] GenWQE: " Geliang Tang
@ 2016-01-14 9:43 ` Viresh Kumar
4 siblings, 0 replies; 8+ messages in thread
From: Viresh Kumar @ 2016-01-14 9:43 UTC (permalink / raw)
To: Geliang Tang; +Cc: Jiri Kosina, Arnd Bergmann, Greg Kroah-Hartman, linux-kernel
On 13-01-16, 23:30, Geliang Tang wrote:
> Use kobj_to_dev() instead of open-coding it.
>
> Signed-off-by: Geliang Tang <geliangtang@163.com>
> ---
> drivers/misc/c2port/core.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
--
viresh
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2016-01-14 9:44 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-13 15:30 [PATCH 1/5] misc: c2port: use kobj_to_dev() Geliang Tang
2016-01-13 15:30 ` [PATCH 2/5] misc: cxl: " Geliang Tang
2016-01-13 21:19 ` Michael Ellerman
2016-01-13 23:00 ` Andrew Donnellan
2016-01-13 15:30 ` [PATCH 3/5] pch_phub: " Geliang Tang
2016-01-13 15:30 ` [PATCH 4/5] misc: eeprom: " Geliang Tang
2016-01-13 15:30 ` [PATCH 5/5] GenWQE: " Geliang Tang
2016-01-14 9:43 ` [PATCH 1/5] misc: c2port: " Viresh Kumar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox