Re: [PATCH v4 03/23] ata: libata-scsi: link ata port and scsi device

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

 



On 2023/09/21 7:16, John Garry wrote:
> On 20/09/2023 14:54, Damien Le Moal wrote:
>> +int ata_scsi_dev_alloc(struct scsi_device *sdev, struct ata_port *ap)
> 
> nit: why not static? I could not see it used elsewhere. Indeed, I am not 
> sure why it is not inlined in its only caller, ata_scsi_slave_alloc().

The initial version of this patchset used this function for libsas as well. But
that is now gone, so I can indeed inline this.
Note that with the STATELESS flag added, the linking of ata dev and scsi dev
should work just fine for libsas now, so we could add it. But I am still not
convinced that is necessary... Will have a look as a follow up.

> 
> Thanks,
> John
> 
>> +{
>> +	struct device_link *link;
>> +
>> +	ata_scsi_sdev_config(sdev);
>> +
>> +	/*
>> +	 * Create a link from the ata_port device to the scsi device to ensure
>> +	 * that PM does suspend/resume in the correct order: the scsi device is
>> +	 * consumer (child) and the ata port the supplier (parent).
>> +	 */
>> +	link = device_link_add(&sdev->sdev_gendev, &ap->tdev,
>> +			       DL_FLAG_STATELESS |
>> +			       DL_FLAG_PM_RUNTIME | DL_FLAG_RPM_ACTIVE);
>> +	if (!link) {
>> +		ata_port_err(ap, "Failed to create link to scsi device %s\n",
>> +			     dev_name(&sdev->sdev_gendev));
>> +		return -ENODEV;
>> +	}
>> +
>> +	return 0;
>> +}
>> +
>> +/**
>> + *	ata_scsi_slave_alloc - Early setup of SCSI device
>> + *	@sdev: SCSI device to examine
>> + *
>> + *	This is called from scsi_alloc_sdev() when the scsi device
>> + *	associated with an ATA device is scanned on a port.
>> + *
>> + *	LOCKING:
>> + *	Defined by SCSI layer.  We don't really care.
>> + */
>> +
>> +int ata_scsi_slave_alloc(struct scsi_device *sdev)
>> +{
>> +	return ata_scsi_dev_alloc(sdev, ata_shost_to_port(sdev->host));
>> +}
>> +EXPORT_SYMBOL_GPL(ata_scsi_slave_alloc);
> 

-- 
Damien Le Moal
Western Digital Research




[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