Re: [PATCH 2/3] scsi_dh: Change scsi device handler modules to utilize modalias

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

 



Konrad Rzeszutek wrote:
> .. snip..
>> +	{TYPE_ANY, "HP", "HSV300" },
>> +	{TYPE_ANY, "IBM", "2107900" },
>> +	{TYPE_ANY, "IBM", "2145" },
>> +	{TYPE_ANY, "Pillar", "Axiom" },
>> +	{0, "", ""},
> 
> Is there a define for '0' value?

This is an array terminator.  Almost nobody uses cpp defines for
terminating values.  (In this case, the actual terminator is "" in the
2nd struct member.)

BTW, Peter,

>> --- linux-2.6.28.orig/drivers/scsi/device_handler/scsi_dh.c
>> +++ linux-2.6.28/drivers/scsi/device_handler/scsi_dh.c
>> @@ -75,7 +75,10 @@ static int scsi_dh_handler_lookup(struct
>>  {
>>  	int i, found = 0;
>>  
>> -	for(i = 0; scsi_dh->devlist[i].vendor; i++) {
>> +	for(i = 0; scsi_dh->devlist[i].vendor[0]; i++) {
>> +		if ((scsi_dh->devlist[i].type != TYPE_ANY) &&
>> +				(scsi_dh->devlist[i].type != sdev->type))
>> +			continue;
>>  		if (!strncmp(sdev->vendor, scsi_dh->devlist[i].vendor,
>>  			     strlen(scsi_dh->devlist[i].vendor)) &&
>>  		    !strncmp(sdev->model, scsi_dh->devlist[i].model,

AFAICS you could have kept the check for .vendor != NULL instead of
.vendor[0] != '\0' and write the terminator thusly:

	{},

Saves the space for a one byte long string in the object files.  :-)
-- 
Stefan Richter
-=====-==--= --== =--=-
http://arcgraph.de/sr/
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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