scsi: sd: Fix 'sdkp' in sd_first_printk
PATCH 1/1 scsi: sd: Fix 'sdkp' in sd_first_printk
In the sd_first_printk macro, replace the sdkp parameter with the defined sdsk parameter to resolve the compilation error.
--- drivers/scsi/sd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/sd.h +1 -1
@@ -133,7 +133,7 @@ static inline struct scsi_disk *scsi_disk(struct gendisk *disk) #define sd_first_printk(prefix, sdsk, fmt, a...) \ do { \ - if ((sdkp)->first_scan) \ + if ((sdsk)->first_scan) \ sd_printk(prefix, sdsk, fmt, ##a); \ } while (0)
Signature · 1 line
2.18.2
Quoted 2 lines · Li kunyu
In the
sd_first_printkmacro, replace the sdkp parameter with the defined sdsk parameter to resolve the compilation error.
Which compilation errors ? None that I can see. Do you mean "to avoid potential compilation errors" ?
Quoted 11 lines
Signed-off-by Li kunyu <[email protected]>--- drivers/scsi/sd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/scsi/sd.h +0
-0
drivers/scsi/sd.h static inline struct scsi_disk *scsi_disk(struct gendisk *disk) · line 136
Quoted 5 lines
drivers/scsi/sd.h +1
-1@@ -133,7 +133,7 @@ static inline struct scsi_disk *scsi_disk(struct gendisk *disk) #define sd_first_printk(prefix, sdsk, fmt, a...) \ do { \ - if ((sdkp)->first_scan) \ + if ((sdsk)->first_scan) \
Instead of changing this one, I would prefer changing sdsk to sdkp in the macro parameter list. "sdkp" is used everywhere in sd.c. "sdsk" is not used anywhere so it would be unclear.
Quoted 3 lines
drivers/scsi/sd.h +0
-0sd_printk(prefix, sdsk, fmt, ##a); \ }while (0 )
Signature · 2 lines
Damien Le Moal Western Digital Research
This is defined in the 4.19 kernel:
#define sd_printk(prefix, sdsk, fmt, a...) \
(sdsk)->disk ? \
sdev_prefix_printk(prefix, (sdsk)->device, \
(sdsk)->disk->disk_name, fmt, ##a) : \
sdev_printk(prefix, (sdsk)->device, fmt, ##a)#define sd_first_printk(prefix, sdsk, fmt, a...) \
do { \
if ((sdkp)->first_scan) \
sd_printk(prefix, sdsk, fmt, ##a); \
} while (0)Most of the sdsk used in the macro definition has only one sdkp.
This is defined in the v6.0-rc7 kernel:
#define sd_printk(prefix, sdsk, fmt, a...) \
(sdsk)->disk ? \
sdev_prefix_printk(prefix, (sdsk)->device, \
(sdsk)->disk->disk_name, fmt, ##a) : \
sdev_printk(prefix, (sdsk)->device, fmt, ##a)#define sd_first_printk(prefix, sdsk, fmt, a...) \
do { \
if ((sdsk)->first_scan) \
sd_printk(prefix, sdsk, fmt, ##a); \
} while (0)Use sdsk in macro definition.
I did report an error when compiling sd. o in the 4.19 kernel. It was modified to say that no more errors were reported in sdsk. Can I continue the 6.0-rc7 writing method here.
Quoted 34 lines · Li kunyu
This is defined in the 4.19 kernel:
#define sd_printk(prefix, sdsk, fmt, a...) \ (sdsk)->disk ? \ sdev_prefix_printk(prefix, (sdsk)->device, \ (sdsk)->disk->disk_name, fmt, ##a) : \ sdev_printk(prefix, (sdsk)->device, fmt, ##a)#define sd_first_printk(prefix, sdsk, fmt, a...) \ do { \ if ((sdkp)->first_scan) \ sd_printk(prefix, sdsk, fmt, ##a); \ } while (0)Most of the sdsk used in the macro definition has only one sdkp.
This is defined in the v6.0-rc7 kernel:
#define sd_printk(prefix, sdsk, fmt, a...) \ (sdsk)->disk ? \ sdev_prefix_printk(prefix, (sdsk)->device, \ (sdsk)->disk->disk_name, fmt, ##a) : \ sdev_printk(prefix, (sdsk)->device, fmt, ##a)#define sd_first_printk(prefix, sdsk, fmt, a...) \ do { \ if ((sdsk)->first_scan) \ sd_printk(prefix, sdsk, fmt, ##a); \ } while (0)
Quoted 5 lines
Use sdsk in macro definition.
I did report an error when compiling sd. o in the 4.19 kernel. It was modified to say that no more errors were reported in sdsk. Can I continue the 6.0-rc7 writing method here.
You should backport the mainline patch to 4.19, not create a new one.
commit df46cac3f71c57e0b23f6865651629aaa54f8ca9
Author: Dietmar Hahn <[email protected]> Date: Tue Feb 5 11:10:48 2019 +0100
scsi: sd: Fix typo in sd_first_printk()
Commit b2bff6ceb61a9 ("[SCSI] sd: Quiesce mode sense error messages") added the macro sd_first_printk(). The macro takes "sdsk" as argument but dereferences "sdkp". This hasn't caused any real issues since all callers of sd_first_printk() have an sdkp. But fix the typo.
[mkp: Turned this into a real patch and tweaked commit description]
drivers/scsi/sd.h +1 -1
@@ -132,7 +132,7 @@ static inline struct scsi_disk *scsi_disk(struct gendisk *disk) #define sd_first_printk(prefix, sdsk, fmt, a...) \ do { \ - if ((sdkp)->first_scan) \ + if ((sdsk)->first_scan) \ sd_printk(prefix, sdsk, fmt, ##a); \ } while (0)
Quoted 3 lines
.
Quoted 36 lines · Jason Yan
Quoted 34 lines · Li kunyu
This is defined in the 4.19 kernel:
#define sd_printk(prefix, sdsk, fmt, a...) \ (sdsk)->disk ? \ sdev_prefix_printk(prefix, (sdsk)->device, \ (sdsk)->disk->disk_name, fmt, ##a) : \ sdev_printk(prefix, (sdsk)->device, fmt, ##a)#define sd_first_printk(prefix, sdsk, fmt, a...) \ do { \ if ((sdkp)->first_scan) \ sd_printk(prefix, sdsk, fmt, ##a); \ } while (0)Most of the sdsk used in the macro definition has only one sdkp.
This is defined in the v6.0-rc7 kernel:
#define sd_printk(prefix, sdsk, fmt, a...) \ (sdsk)->disk ? \ sdev_prefix_printk(prefix, (sdsk)->device, \ (sdsk)->disk->disk_name, fmt, ##a) : \ sdev_printk(prefix, (sdsk)->device, fmt, ##a)#define sd_first_printk(prefix, sdsk, fmt, a...) \ do { \ if ((sdsk)->first_scan) \ sd_printk(prefix, sdsk, fmt, ##a); \ } while (0)
Quoted 7 lines
Quoted 5 lines
Use sdsk in macro definition.
I did report an error when compiling sd. o in the 4.19 kernel. It was modified to say that no more errors were reported in sdsk. Can I continue the 6.0-rc7 writing method here.
You should backport the mainline patch to 4.19, not create a new one.
Yes, but since the mainline patch has a typo, better fix it and backport the fix too with a "Fixes" tag.
My point about the proposed patch was to make the reverse change to fix the
macro: use sdkp instead of sdsk since the former is used everywhere and clear. But sure, since this is not causing any issue, no strong need to fix the macro. It is really ugly as-is though :)
Quoted 36 lines
commit
df46cac3f71c57e0b23f6865651629aaa54f8ca9Author: Dietmar Hahn <[email protected]> Date: Tue Feb 5 11:10:48 2019 +0100scsi: sd: Fix typo in
sd_first_printk()Commit
b2bff6ceb61a9("[SCSI] sd: Quiesce mode sense error messages") added the macrosd_first_printk(). The macro takes "sdsk" as argument but dereferences "sdkp". This hasn't caused any real issues since all callers ofsd_first_printk()have an sdkp. But fix the typo.[mkp: Turned this into a real patch and tweaked commit description]
Signed-off-by Dietmar Hahn <[email protected]>Signed-off-by Martin K. Petersen <[email protected]>drivers/scsi/sd.h +1
-1@@ -132,7 +132,7 @@ static inline struct scsi_disk *scsi_disk(struct gendisk *disk) #define sd_first_printk(prefix, sdsk, fmt, a...) \ do { \ - if ((sdkp)->first_scan) \ + if ((sdsk)->first_scan) \ sd_printk(prefix, sdsk, fmt, ##a); \ } while (0)Quoted 6 lines
.
Signature · 2 lines
Damien Le Moal Western Digital Research
Quoted 40 lines · Damien Le Moal
Quoted 39 lines · Jason Yan
Quoted 37 lines · Li kunyu
This is defined in the 4.19 kernel:
#define sd_printk(prefix, sdsk, fmt, a...) \ (sdsk)->disk ? \ sdev_prefix_printk(prefix, (sdsk)->device, \ (sdsk)->disk->disk_name, fmt, ##a) : \ sdev_printk(prefix, (sdsk)->device, fmt, ##a)#define sd_first_printk(prefix, sdsk, fmt, a...) \ do { \ if ((sdkp)->first_scan) \ sd_printk(prefix, sdsk, fmt, ##a); \ } while (0)Most of the sdsk used in the macro definition has only one sdkp.
This is defined in the v6.0-rc7 kernel:
#define sd_printk(prefix, sdsk, fmt, a...) \ (sdsk)->disk ? \ sdev_prefix_printk(prefix, (sdsk)->device, \ (sdsk)->disk->disk_name, fmt, ##a) : \ sdev_printk(prefix, (sdsk)->device, fmt, ##a)#define sd_first_printk(prefix, sdsk, fmt, a...) \ do { \ if ((sdsk)->first_scan) \ sd_printk(prefix, sdsk, fmt, ##a); \ } while (0)Use sdsk in macro definition.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
I did report an error when compiling sd. o in the 4.19 kernel. It was modified to say that no more errors were reported in sdsk. Can I continue the 6.0-rc7 writing method here.
You should backport the mainline patch to 4.19, not create a new one.
Yes, but since the mainline patch has a typo, better fix it and backport the fix too with a "Fixes" tag.
What typo in the patch? I did not see it.
Quoted 5 lines
My point about the proposed patch was to make the reverse change to fix the
macro: use sdkp instead of sdsk since the former is used everywhere and clear. But sure, since this is not causing any issue, no strong need to fix the macro. It is really ugly as-is though :)
I agree that there is no need to backport it.
Thanks,
Jason
Quoted 37 lines
Quoted 36 lines
commit
df46cac3f71c57e0b23f6865651629aaa54f8ca9Author: Dietmar Hahn <[email protected]> Date: Tue Feb 5 11:10:48 2019 +0100scsi: sd: Fix typo in
sd_first_printk()Commit
b2bff6ceb61a9("[SCSI] sd: Quiesce mode sense error messages") added the macrosd_first_printk(). The macro takes "sdsk" as argument but dereferences "sdkp". This hasn't caused any real issues since all callers ofsd_first_printk()have an sdkp. But fix the typo.[mkp: Turned this into a real patch and tweaked commit description]
Signed-off-by Dietmar Hahn <[email protected]>Signed-off-by Martin K. Petersen <[email protected]>drivers/scsi/sd.h +1
-1@@ -132,7 +132,7 @@ static inline struct scsi_disk *scsi_disk(struct gendisk *disk) #define sd_first_printk(prefix, sdsk, fmt, a...) \ do { \ - if ((sdkp)->first_scan) \ + if ((sdsk)->first_scan) \ sd_printk(prefix, sdsk, fmt, ##a); \ } while (0)Quoted 6 lines
.
Quoted 45 lines · Jason Yan
Quoted 43 lines · Damien Le Moal
Quoted 42 lines · Jason Yan
Quoted 39 lines · Li kunyu
This is defined in the 4.19 kernel:
#define sd_printk(prefix, sdsk, fmt, a...) \ (sdsk)->disk ? \ sdev_prefix_printk(prefix, (sdsk)->device, \ (sdsk)->disk->disk_name, fmt, ##a) : \ sdev_printk(prefix, (sdsk)->device, fmt, ##a)#define sd_first_printk(prefix, sdsk, fmt, a...) \ do { \ if ((sdkp)->first_scan) \ sd_printk(prefix, sdsk, fmt, ##a); \ } while (0)Most of the sdsk used in the macro definition has only one sdkp.
This is defined in the v6.0-rc7 kernel:
#define sd_printk(prefix, sdsk, fmt, a...) \ (sdsk)->disk ? \ sdev_prefix_printk(prefix, (sdsk)->device, \ (sdsk)->disk->disk_name, fmt, ##a) : \ sdev_printk(prefix, (sdsk)->device, fmt, ##a)#define sd_first_printk(prefix, sdsk, fmt, a...) \ do { \ if ((sdsk)->first_scan) \ sd_printk(prefix, sdsk, fmt, ##a); \ } while (0)Use sdsk in macro definition.
I did report an error when compiling sd. o in the 4.19 kernel. It was modified to say that no more errors were reported in sdsk. Can I continue the 6.0-rc7 writing method here.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
You should backport the mainline patch to 4.19, not create a new one.
Yes, but since the mainline patch has a typo, better fix it and backport the fix too with a "Fixes" tag.
What typo in the patch? I did not see it.
I meant the weird variable name sdsk in the original patch instead of the more natural sdkp.
Quoted 8 lines
Quoted 6 lines
My point about the proposed patch was to make the reverse change to fix the
macro: use sdkp instead of sdsk since the former is used everywhere and clear. But sure, since this is not causing any issue, no strong need to fix the macro. It is really ugly as-is though :)I agree that there is no need to backport it.
Yes. Beside using that strange variable name, no problem.
Quoted 41 lines
Thanks,
JasonQuoted 37 lines
Quoted 36 lines
commit
df46cac3f71c57e0b23f6865651629aaa54f8ca9Author: Dietmar Hahn <[email protected]> Date: Tue Feb 5 11:10:48 2019 +0100scsi: sd: Fix typo in
sd_first_printk()Commit
b2bff6ceb61a9("[SCSI] sd: Quiesce mode sense error messages") added the macrosd_first_printk(). The macro takes "sdsk" as argument but dereferences "sdkp". This hasn't caused any real issues since all callers ofsd_first_printk()have an sdkp. But fix the typo.[mkp: Turned this into a real patch and tweaked commit description]
Signed-off-by Dietmar Hahn <[email protected]>Signed-off-by Martin K. Petersen <[email protected]>drivers/scsi/sd.h +1
-1@@ -132,7 +132,7 @@ static inline struct scsi_disk *scsi_disk(struct gendisk *disk) #define sd_first_printk(prefix, sdsk, fmt, a...) \ do { \ - if ((sdkp)->first_scan) \ + if ((sdsk)->first_scan) \ sd_printk(prefix, sdsk, fmt, ##a); \ } while (0)Quoted 6 lines
.
Signature · 2 lines
Damien Le Moal Western Digital Research
Hello, I'm not sure how to operate it. Do you want to execute git push to submit this patch in branch 4.19.
thanks,
kunyu
Quoted 6 lines · Li kunyu
Hello, I'm not sure how to operate it. Do you want to execute git push to submit this patch in branch 4.19.
thanks,
kunyu
Please see Documentation/process/stable-kernel-rules.rst for how to proceed. In this case, I think you should follow "option 2", but read the entire document to understand all cases.
Signature · 2 lines
Damien Le Moal Western Digital Research
I see. I will send it after I understand the steps.