public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix leftover from default sdev attribute switch
@ 2007-09-26 17:54 Kay Sievers
  2007-09-26 18:23 ` James Bottomley
  0 siblings, 1 reply; 5+ messages in thread
From: Kay Sievers @ 2007-09-26 17:54 UTC (permalink / raw)
  To: James Bottomley; +Cc: linux-scsi

Hi James,
seems we miss the following fix in the current tree.

Thanks,
Kay


From: Kay Sievers <kay.sievers@vrfy.org>
Subject: [SCSI] fix scsi_is_sdev_device() after switch to default sdev attributes

Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
---
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 0088c4d..8e880ef 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -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);
 


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] fix leftover from default sdev attribute switch
  2007-09-26 17:54 [PATCH] fix leftover from default sdev attribute switch Kay Sievers
@ 2007-09-26 18:23 ` James Bottomley
  2007-09-26 18:32   ` Kay Sievers
  0 siblings, 1 reply; 5+ messages in thread
From: James Bottomley @ 2007-09-26 18:23 UTC (permalink / raw)
  To: Kay Sievers; +Cc: linux-scsi

On Wed, 2007-09-26 at 19:54 +0200, Kay Sievers wrote:
> Hi James,
> seems we miss the following fix in the current tree.
> 
> Thanks,
> Kay
> 
> 
> From: Kay Sievers <kay.sievers@vrfy.org>
> Subject: [SCSI] fix scsi_is_sdev_device() after switch to default sdev attributes
> 
> Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
> ---
> diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
> index 0088c4d..8e880ef 100644
> --- a/drivers/scsi/scsi_sysfs.c
> +++ b/drivers/scsi/scsi_sysfs.c
> @@ -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



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] fix leftover from default sdev attribute switch
  2007-09-26 18:23 ` James Bottomley
@ 2007-09-26 18:32   ` Kay Sievers
  2007-09-26 20:08     ` James Bottomley
  0 siblings, 1 reply; 5+ messages in thread
From: Kay Sievers @ 2007-09-26 18:32 UTC (permalink / raw)
  To: James Bottomley; +Cc: linux-scsi

On Wed, 2007-09-26 at 13:23 -0500, James Bottomley wrote:
> On Wed, 2007-09-26 at 19:54 +0200, Kay Sievers wrote:
> > Hi James,
> > seems we miss the following fix in the current tree.
> > 
> > From: Kay Sievers <kay.sievers@vrfy.org>
> > Subject: [SCSI] fix scsi_is_sdev_device() after switch to default sdev attributes
> > 
> > Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
> > ---
> > diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
> > index 0088c4d..8e880ef 100644
> > --- a/drivers/scsi/scsi_sysfs.c
> > +++ b/drivers/scsi/scsi_sysfs.c
> > @@ -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?

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] fix leftover from default sdev attribute switch
  2007-09-26 18:32   ` Kay Sievers
@ 2007-09-26 20:08     ` James Bottomley
  2007-09-26 20:19       ` Kay Sievers
  0 siblings, 1 reply; 5+ messages in thread
From: James Bottomley @ 2007-09-26 20:08 UTC (permalink / raw)
  To: Kay Sievers; +Cc: linux-scsi

On Wed, 2007-09-26 at 20:32 +0200, Kay Sievers wrote:
> On Wed, 2007-09-26 at 13:23 -0500, James Bottomley wrote:
> > On Wed, 2007-09-26 at 19:54 +0200, Kay Sievers wrote:
> > > Hi James,
> > > seems we miss the following fix in the current tree.
> > > 
> > > From: Kay Sievers <kay.sievers@vrfy.org>
> > > Subject: [SCSI] fix scsi_is_sdev_device() after switch to default sdev attributes
> > > 
> > > Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
> > > ---
> > > diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
> > > index 0088c4d..8e880ef 100644
> > > --- a/drivers/scsi/scsi_sysfs.c
> > > +++ b/drivers/scsi/scsi_sysfs.c
> > > @@ -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?
> 
> 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.

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



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] fix leftover from default sdev attribute switch
  2007-09-26 20:08     ` James Bottomley
@ 2007-09-26 20:19       ` Kay Sievers
  0 siblings, 0 replies; 5+ messages in thread
From: Kay Sievers @ 2007-09-26 20:19 UTC (permalink / raw)
  To: James Bottomley; +Cc: linux-scsi


On Wed, 2007-09-26 at 15:08 -0500, James Bottomley wrote:
> On Wed, 2007-09-26 at 20:32 +0200, Kay Sievers wrote:
> > On Wed, 2007-09-26 at 13:23 -0500, James Bottomley wrote:
> > > On Wed, 2007-09-26 at 19:54 +0200, Kay Sievers wrote:
> > > > Hi James,
> > > > seems we miss the following fix in the current tree.
> > > > 
> > > > From: Kay Sievers <kay.sievers@vrfy.org>
> > > > Subject: [SCSI] fix scsi_is_sdev_device() after switch to default sdev attributes
> > > > 
> > > > Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
> > > > ---
> > > > diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
> > > > index 0088c4d..8e880ef 100644
> > > > --- a/drivers/scsi/scsi_sysfs.c
> > > > +++ b/drivers/scsi/scsi_sysfs.c
> > > > @@ -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?
> > 
> > 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.
> 
> 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.

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-09-26 20:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-26 17:54 [PATCH] fix leftover from default sdev attribute switch Kay Sievers
2007-09-26 18:23 ` James Bottomley
2007-09-26 18:32   ` Kay Sievers
2007-09-26 20:08     ` James Bottomley
2007-09-26 20:19       ` Kay Sievers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox