2022-05-10 20:45:29

by CGEL

[permalink] [raw]
Subject: [PATCH] [SCSI] ipr: use kobj_to_dev()

From: Minghao Chi <[email protected]>

Use kobj_to_dev() instead of open-coding it.

Reported-by: Zeal Robot <[email protected]>
Signed-off-by: Minghao Chi <[email protected]>
---
drivers/scsi/ipr.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 353cf47db79c..256ec6d08c16 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -3456,7 +3456,7 @@ static ssize_t ipr_read_trace(struct file *filp, struct kobject *kobj,
struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{
- struct device *dev = container_of(kobj, struct device, kobj);
+ struct device *dev = kobj_to_dev(kobj);
struct Scsi_Host *shost = class_to_shost(dev);
struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata;
unsigned long lock_flags = 0;
@@ -4182,7 +4182,7 @@ static ssize_t ipr_read_async_err_log(struct file *filep, struct kobject *kobj,
struct bin_attribute *bin_attr, char *buf,
loff_t off, size_t count)
{
- struct device *cdev = container_of(kobj, struct device, kobj);
+ struct device *cdev = kobj_to_dev(kobj);
struct Scsi_Host *shost = class_to_shost(cdev);
struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata;
struct ipr_hostrcb *hostrcb;
@@ -4206,7 +4206,7 @@ static ssize_t ipr_next_async_err_log(struct file *filep, struct kobject *kobj,
struct bin_attribute *bin_attr, char *buf,
loff_t off, size_t count)
{
- struct device *cdev = container_of(kobj, struct device, kobj);
+ struct device *cdev = kobj_to_dev(kobj);
struct Scsi_Host *shost = class_to_shost(cdev);
struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata;
struct ipr_hostrcb *hostrcb;
@@ -4267,7 +4267,7 @@ static ssize_t ipr_read_dump(struct file *filp, struct kobject *kobj,
struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{
- struct device *cdev = container_of(kobj, struct device, kobj);
+ struct device *cdev = kobj_to_dev(kobj);
struct Scsi_Host *shost = class_to_shost(cdev);
struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata;
struct ipr_dump *dump;
@@ -4456,7 +4456,7 @@ static ssize_t ipr_write_dump(struct file *filp, struct kobject *kobj,
struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{
- struct device *cdev = container_of(kobj, struct device, kobj);
+ struct device *cdev = kobj_to_dev(kobj);
struct Scsi_Host *shost = class_to_shost(cdev);
struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata;
int rc;
--
2.25.1




2022-05-12 18:24:49

by Brian King

[permalink] [raw]
Subject: Re: [PATCH] [SCSI] ipr: use kobj_to_dev()

Acked-by: Brian King <[email protected]>

--
Brian King
Power Linux I/O
IBM Linux Technology Center


2022-05-17 12:35:26

by Martin K. Petersen

[permalink] [raw]
Subject: Re: [PATCH] [SCSI] ipr: use kobj_to_dev()


> Use kobj_to_dev() instead of open-coding it.

Applied to 5.19/scsi-staging, thanks!

--
Martin K. Petersen Oracle Linux Engineering

2022-05-22 16:39:13

by Martin K. Petersen

[permalink] [raw]
Subject: Re: [PATCH] [SCSI] ipr: use kobj_to_dev()

On Tue, 10 May 2022 10:51:13 +0000, [email protected] wrote:

> From: Minghao Chi <[email protected]>
>
> Use kobj_to_dev() instead of open-coding it.
>
>

Applied to 5.19/scsi-queue, thanks!

[1/1] ipr: use kobj_to_dev()
https://git.kernel.org/mkp/scsi/c/aabd5fea4946

--
Martin K. Petersen Oracle Linux Engineering