From: Damien Le Moal <damien.lemoal@opensource.wdc.com>
To: Jason Yan <yanaijie@huawei.com>, Li kunyu <kunyu@nfschina.com>
Cc: jejb@linux.vnet.ibm.com, linux-kernel@vger.kernel.org,
linux-scsi@vger.kernel.org, martin.petersen@oracle.com
Subject: Re: [PATCH 4.19] scsi: sd: Fix 'sdkp' in sd_first_printk
Date: Thu, 13 Oct 2022 16:14:12 +0900 [thread overview]
Message-ID: <4fc8207d-0851-3b38-339d-de1452f6ee4d@opensource.wdc.com> (raw)
In-Reply-To: <7baa5eb6-95f7-a0cb-6aef-157cf43866e7@huawei.com>
On 2022/10/13 16:02, Jason Yan wrote:
>
> On 2022/10/13 14:39, Damien Le Moal wrote:
>> On 2022/10/13 15:26, Jason Yan wrote:
>>>
>>> On 2022/10/13 12:49, Li kunyu wrote:
>>>>
>>>> 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.
>>>>
>>>
>>> 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.
>
>> 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.
>
> Thanks,
> Jason
>
>>>
>>> commit df46cac3f71c57e0b23f6865651629aaa54f8ca9
>>> Author: Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
>>> 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]
>>>
>>> Signed-off-by: Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
>>> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
>>>
>>> diff --git a/drivers/scsi/sd.h b/drivers/scsi/sd.h
>>> index 1080c85d97f8..5796ace76225 100644
>>> --- a/drivers/scsi/sd.h
>>> +++ b/drivers/scsi/sd.h
>>> @@ -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)
>>>
>>>
>>>
>>>>
>>>> .
>>>>
>>
--
Damien Le Moal
Western Digital Research
next prev parent reply other threads:[~2022-10-13 7:14 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-13 2:34 Li kunyu
2022-10-13 3:54 ` Damien Le Moal
2022-10-13 4:49 ` Li kunyu
2022-10-13 6:26 ` Jason Yan
2022-10-13 6:39 ` Damien Le Moal
2022-10-13 7:02 ` Jason Yan
2022-10-13 7:14 ` Damien Le Moal [this message]
2022-10-13 7:39 ` Li kunyu
2022-10-13 7:52 ` Damien Le Moal
2022-10-13 8:37 ` Li kunyu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4fc8207d-0851-3b38-339d-de1452f6ee4d@opensource.wdc.com \
--to=damien.lemoal@opensource.wdc.com \
--cc=jejb@linux.vnet.ibm.com \
--cc=kunyu@nfschina.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=yanaijie@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®