Re: [PATCH v2 02/50] core: Use scsi_cmd_to_rq() instead of scsi_cmnd.request

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/18/21 1:01 PM, Douglas Gilbert wrote:
> On 2021-05-18 1:44 p.m., Bart Van Assche wrote:
>> diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
>> index ac6ab16abee7..09797a2b779d 100644
>> --- a/include/scsi/scsi_device.h
>> +++ b/include/scsi/scsi_device.h
>> @@ -265,13 +265,15 @@ sdev_prefix_printk(const char *, const struct
>> scsi_device *, const char *,
>>   __printf(3, 4) void
>>   scmd_printk(const char *, const struct scsi_cmnd *, const char *, ...);
>>   -#define scmd_dbg(scmd, fmt, a...)                       \
>> -    do {                                   \
>> -        if ((scmd)->request->rq_disk)                   \
>> -            sdev_dbg((scmd)->device, "[%s] " fmt,           \
>> -                 (scmd)->request->rq_disk->disk_name, ##a);\
>> -        else                               \
>> -            sdev_dbg((scmd)->device, fmt, ##a);           \
>> +#define scmd_dbg(scmd, fmt, a...)                \
>> +    do {                            \
>> +        struct request *rq = scsi_cmd_to_rq((scmd));    \
> 
> When introducing a new name (e.g. rq) in a macro, shouldn't it be prefixed
> with either a single or double underscore? There is a good chance rq maybe
> in use in the enclosing scope causing a compiler warning.

Hi Doug,

Thanks for having taken a look. I will insert one or more underscores in
front of the 'rq' variable name or remove that variable again. It is not
clear to me whether there is a general rule. In include/linux/kernel.h I
found a variable that has a prefix of seven underscores:

#define trace_printk(fmt, ...)                          \
do {                                                    \
        char _______STR[] = __stringify((__VA_ARGS__)); \
        if (sizeof(_______STR) > 3)                     \
                do_trace_printk(fmt, ##__VA_ARGS__);    \
        else                                            \
                trace_puts(fmt);                        \
} while (0)

Bart.



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux