Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 98599
b: refs/heads/master
c: ec5e69f
h: refs/heads/master
i:
  98597: d01a644
  98595: 746ef0c
  98591: cd2a8d4
v: v3
  • Loading branch information
James Bottomley authored and James Bottomley committed Jun 25, 2008
1 parent 1644391 commit c8570a0
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 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: eadc49b1a8d09480f14caea292142f103a89c77a
refs/heads/master: ec5e69f6d3f4350681d6f7eaae515cf014be9276
30 changes: 20 additions & 10 deletions trunk/drivers/scsi/esp_scsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -2359,6 +2359,24 @@ void scsi_esp_unregister(struct esp *esp)
}
EXPORT_SYMBOL(scsi_esp_unregister);

static int esp_target_alloc(struct scsi_target *starget)
{
struct esp *esp = shost_priv(dev_to_shost(&starget->dev));
struct esp_target_data *tp = &esp->target[starget->id];

tp->starget = starget;

return 0;
}

static void esp_target_destroy(struct scsi_target *starget)
{
struct esp *esp = shost_priv(dev_to_shost(&starget->dev));
struct esp_target_data *tp = &esp->target[starget->id];

tp->starget = NULL;
}

static int esp_slave_alloc(struct scsi_device *dev)
{
struct esp *esp = shost_priv(dev->host);
Expand All @@ -2370,9 +2388,6 @@ static int esp_slave_alloc(struct scsi_device *dev)
return -ENOMEM;
dev->hostdata = lp;

tp->starget = dev->sdev_target;
tp->starget_ref++;

spi_min_period(tp->starget) = esp->min_period;
spi_max_offset(tp->starget) = 15;

Expand Down Expand Up @@ -2426,17 +2441,10 @@ static int esp_slave_configure(struct scsi_device *dev)

static void esp_slave_destroy(struct scsi_device *dev)
{
struct esp *esp = shost_priv(dev->host);
struct esp_target_data *tp = &esp->target[dev->id];
struct esp_lun_data *lp = dev->hostdata;

kfree(lp);
dev->hostdata = NULL;

BUG_ON(tp->starget_ref <= 0);

if (!--tp->starget_ref)
tp->starget = NULL;
}

static int esp_eh_abort_handler(struct scsi_cmnd *cmd)
Expand Down Expand Up @@ -2616,6 +2624,8 @@ struct scsi_host_template scsi_esp_template = {
.name = "esp",
.info = esp_info,
.queuecommand = esp_queuecommand,
.target_alloc = esp_target_alloc,
.target_destroy = esp_target_destroy,
.slave_alloc = esp_slave_alloc,
.slave_configure = esp_slave_configure,
.slave_destroy = esp_slave_destroy,
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/scsi/esp_scsi.h
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,6 @@ struct esp_target_data {
u8 nego_goal_tags;

struct scsi_target *starget;
int starget_ref;
};

struct esp_event_ent {
Expand Down

0 comments on commit c8570a0

Please sign in to comment.