Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 62736
b: refs/heads/master
c: b6aff66
h: refs/heads/master
v: v3
  • Loading branch information
James Bottomley authored and James Bottomley committed Jul 20, 2007
1 parent 66ecdbd commit 85c6633
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e7cbff13ec1f236a3f8341c503a2e1bd0cf692e5
refs/heads/master: b6aff66953a29e40e0683be9b39c369ade143a5b
36 changes: 35 additions & 1 deletion trunk/drivers/scsi/scsi_transport_sas.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
struct sas_host_attrs {
struct list_head rphy_list;
struct mutex lock;
struct request_queue *q;
u32 next_target_id;
u32 next_expander_id;
int next_port_id;
Expand Down Expand Up @@ -214,6 +215,11 @@ static int sas_bsg_initialize(struct Scsi_Host *shost, struct sas_rphy *rphy,
return -ENOMEM;
}

if (rphy)
rphy->q = q;
else
to_sas_host_attrs(shost)->q = q;

if (rphy)
q->queuedata = rphy;
else
Expand All @@ -224,6 +230,22 @@ static int sas_bsg_initialize(struct Scsi_Host *shost, struct sas_rphy *rphy,
return 0;
}

static void sas_bsg_remove(struct Scsi_Host *shost, struct sas_rphy *rphy)
{
struct request_queue *q;

if (rphy)
q = rphy->q;
else
q = to_sas_host_attrs(shost)->q;

if (!q)
return;

bsg_unregister_queue(q);
blk_cleanup_queue(q);
}

/*
* SAS host attributes
*/
Expand All @@ -249,8 +271,18 @@ static int sas_host_setup(struct transport_container *tc, struct device *dev,
return 0;
}

static int sas_host_remove(struct transport_container *tc, struct device *dev,
struct class_device *cdev)
{
struct Scsi_Host *shost = dev_to_shost(dev);

sas_bsg_remove(shost, NULL);

return 0;
}

static DECLARE_TRANSPORT_CLASS(sas_host_class,
"sas_host", sas_host_setup, NULL, NULL);
"sas_host", sas_host_setup, sas_host_remove, NULL);

static int sas_host_match(struct attribute_container *cont,
struct device *dev)
Expand Down Expand Up @@ -1414,6 +1446,8 @@ void sas_rphy_free(struct sas_rphy *rphy)
list_del(&rphy->list);
mutex_unlock(&sas_host->lock);

sas_bsg_remove(shost, rphy);

transport_destroy_device(dev);

put_device(dev);
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/scsi/scsi_transport_sas.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,12 @@ struct sas_phy {
#define phy_to_shost(phy) \
dev_to_shost((phy)->dev.parent)

struct request_queue;
struct sas_rphy {
struct device dev;
struct sas_identify identify;
struct list_head list;
struct request_queue *q;
u32 scsi_target_id;
};

Expand Down

0 comments on commit 85c6633

Please sign in to comment.