fix leftover from default sdev attribute switch
PATCH 1/1 fix leftover from default sdev attribute switch
Hi James,
seems we miss the following fix in the current tree.
Thanks,
Kay
From: Kay Sievers <[email protected]>
Subject: [SCSI] fix scsi_is_sdev_device() after switch to default sdev attributes
---
drivers/scsi/scsi_sysfs.c +1 -1
@@ -995,7 +995,7 @@ void scsi_sysfs_device_initialize(struct scsi_device *sdev)int scsi_is_sdev_device (const struct device *dev) { -return dev->release == scsi_device_dev_release; +return dev->type == &scsi_dev_type; }EXPORT_SYMBOL (scsi_is_sdev_device);
Quoted 17 lines · Kay Sievers
Hi James,
seems we miss the following fix in the current tree.Thanks,
KayFrom: Kay Sievers <[email protected]>
Subject: [SCSI] fixscsi_is_sdev_device()after switch to default sdev attributesSigned-off-by Kay Sievers <[email protected]>---
drivers/scsi/scsi_sysfs.c +0
-0
drivers/scsi/scsi_sysfs.c void scsi_sysfs_device_initialize(struct scsi_device *sdev) · line 998
Quoted 5 lines
drivers/scsi/scsi_sysfs.c +1
-1@@ -995,7 +995,7 @@ void scsi_sysfs_device_initialize(struct scsi_device *sdev)int scsi_is_sdev_device (const struct device *dev) { -return dev->release == scsi_device_dev_release; +return dev->type == &scsi_dev_type;
This will make the check different from all the others in the mid-layer ... is there any reason to change it?
James
Quoted 15 lines · James Bottomley
Quoted 14 lines · Kay Sievers
Hi James,
seems we miss the following fix in the current tree.From: Kay Sievers <[email protected]>
Subject: [SCSI] fixscsi_is_sdev_device()after switch to default sdev attributesSigned-off-by Kay Sievers <[email protected]>---
drivers/scsi/scsi_sysfs.c +0
-0@@ -995,7 +995,7 @@ void scsi_sysfs_device_initialize(struct scsi_device *sdev)
Quoted 7 lines
drivers/scsi/scsi_sysfs.c void scsi_sysfs_device_initialize(struct scsi_device *sdev) · line 998
Quoted 4 lines
drivers/scsi/scsi_sysfs.c +1
-1int scsi_is_sdev_device (const struct device *dev) { -return dev->release == scsi_device_dev_release; +return dev->type == &scsi_dev_type;This will make the check different from all the others in the mid-layer ... is there any reason to change it?
The release function moved to device_type, so the "hack" with checking for the release pointer at the device doesn't work anymore. With Hannes' patches here on the list, the target and host will get device_type too, and the same way of matching.
Kay
Quoted 24 lines · Kay Sievers
Quoted 15 lines · James Bottomley
Quoted 14 lines · Kay Sievers
Hi James,
seems we miss the following fix in the current tree.From: Kay Sievers <[email protected]>
Subject: [SCSI] fixscsi_is_sdev_device()after switch to default sdev attributesSigned-off-by Kay Sievers <[email protected]>---
drivers/scsi/scsi_sysfs.c +0
-0@@ -995,7 +995,7 @@ void scsi_sysfs_device_initialize(struct scsi_device *sdev)Quoted 7 lines
drivers/scsi/scsi_sysfs.c void scsi_sysfs_device_initialize(struct scsi_device *sdev) · line 998
Quoted 4 lines
drivers/scsi/scsi_sysfs.c +1
-1int scsi_is_sdev_device (const struct device *dev) { -return dev->release == scsi_device_dev_release; +return dev->type == &scsi_dev_type;This will make the check different from all the others in the mid-layer ... is there any reason to change it?
Quoted 4 lines
The release function moved to
device_type, so the "hack" with checking for the release pointer at the device doesn't work anymore. With Hannes' patches here on the list, the target and host will getdevice_typetoo, and the same way of matching.
So all the other ones are incorrect and need fixing? That's
hosts.c:int scsi_is_host_device(const struct device *dev) scsi_scan.c:int scsi_is_target_device(const struct device *dev) scsi_transport_fc.c:int scsi_is_fc_rport(const struct device *dev) scsi_transport_fc.c:int scsi_is_fc_vport(const struct device *dev) scsi_transport_iscsi.c:static int iscsi_is_session_dev(const struct device *dev)
scsi_transport_iscsi.c:static int iscsi_is_conn_dev(const struct device *dev)
scsi_transport_sas.c:int scsi_is_sas_phy(const struct device *dev) scsi_transport_sas.c:int scsi_is_sas_port(const struct device *dev) scsi_transport_sas.c:int scsi_is_sas_rphy(const struct device *dev)
Checking the release function is the way each of these passes the test.
James
Quoted 45 lines · James Bottomley
Quoted 24 lines · Kay Sievers
Quoted 15 lines · James Bottomley
Quoted 14 lines · Kay Sievers
Hi James,
seems we miss the following fix in the current tree.From: Kay Sievers <[email protected]>
Subject: [SCSI] fixscsi_is_sdev_device()after switch to default sdev attributesSigned-off-by Kay Sievers <[email protected]>---
drivers/scsi/scsi_sysfs.c +0
-0@@ -995,7 +995,7 @@ void scsi_sysfs_device_initialize(struct scsi_device *sdev)Quoted 7 lines
drivers/scsi/scsi_sysfs.c void scsi_sysfs_device_initialize(struct scsi_device *sdev) · line 998
Quoted 4 lines
drivers/scsi/scsi_sysfs.c +1
-1int scsi_is_sdev_device (const struct device *dev) { -return dev->release == scsi_device_dev_release; +return dev->type == &scsi_dev_type;This will make the check different from all the others in the mid-layer ... is there any reason to change it?
Quoted 4 lines
The release function moved to
device_type, so the "hack" with checking for the release pointer at the device doesn't work anymore. With Hannes' patches here on the list, the target and host will getdevice_typetoo, and the same way of matching.So all the other ones are incorrect and need fixing? That's
hosts.c:int
scsi_is_host_device(const struct device *dev)scsi_scan.c:intscsi_is_target_device(const struct device *dev)scsi_transport_fc.c:intscsi_is_fc_rport(const struct device *dev)scsi_transport_fc.c:intscsi_is_fc_vport(const struct device *dev)scsi_transport_iscsi.c:static intiscsi_is_session_dev(const struct device *dev)
scsi_transport_iscsi.c:static intiscsi_is_conn_dev(const struct device *dev)
scsi_transport_sas.c:intscsi_is_sas_phy(const struct device *dev)scsi_transport_sas.c:intscsi_is_sas_port(const struct device *dev)scsi_transport_sas.c:intscsi_is_sas_rphy(const struct device *dev)
Quoted 1 line
Checking the release function is the way each of these passes the test.
Oh no, they are all correct.
It's just sdev after the conversion from open-coded attribute creation to "default attributes" created by the core. Sdev uses device_type now, and device_type has the release function for all devices of that type, instead of the individually assigned ones.
Hannes' patches convert host and target to device_type so they can join the scsi-bus in sysfs. They will have the same logic based on device type instead of the release pointer trick. But that's not in your tree now.
Kay