diff options
Diffstat (limited to 'drivers/scsi/ses.c')
-rw-r--r-- | drivers/scsi/ses.c | 35 |
1 files changed, 7 insertions, 28 deletions
diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c index e946e05db7f..4f618f48735 100644 --- a/drivers/scsi/ses.c +++ b/drivers/scsi/ses.c @@ -264,6 +264,7 @@ struct ses_host_edev { struct enclosure_device *edev; }; +#if 0 int ses_match_host(struct enclosure_device *edev, void *data) { struct ses_host_edev *sed = data; @@ -280,6 +281,7 @@ int ses_match_host(struct enclosure_device *edev, void *data) sed->edev = edev; return 1; } +#endif /* 0 */ static void ses_process_descriptor(struct enclosure_component *ecomp, unsigned char *desc) @@ -345,44 +347,21 @@ static int ses_enclosure_find_by_addr(struct enclosure_device *edev, return 0; } -#define VPD_INQUIRY_SIZE 36 - static void ses_match_to_enclosure(struct enclosure_device *edev, struct scsi_device *sdev) { - unsigned char *buf = kmalloc(VPD_INQUIRY_SIZE, GFP_KERNEL); + unsigned char *buf; unsigned char *desc; - u16 vpd_len; + unsigned int vpd_len; struct efd efd = { .addr = 0, }; - unsigned char cmd[] = { - INQUIRY, - 1, - 0x83, - VPD_INQUIRY_SIZE >> 8, - VPD_INQUIRY_SIZE & 0xff, - 0 - }; + buf = scsi_get_vpd_page(sdev, 0x83); if (!buf) return; - if (scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buf, - VPD_INQUIRY_SIZE, NULL, SES_TIMEOUT, SES_RETRIES, - NULL)) - goto free; - - vpd_len = (buf[2] << 8) + buf[3]; - kfree(buf); - buf = kmalloc(vpd_len, GFP_KERNEL); - if (!buf) - return; - cmd[3] = vpd_len >> 8; - cmd[4] = vpd_len & 0xff; - if (scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buf, - vpd_len, NULL, SES_TIMEOUT, SES_RETRIES, NULL)) - goto free; + vpd_len = ((buf[2] << 8) | buf[3]) + 4; desc = buf + 4; while (desc < buf + vpd_len) { @@ -393,7 +372,7 @@ static void ses_match_to_enclosure(struct enclosure_device *edev, u8 type = desc[1] & 0x0f; u8 len = desc[3]; - if (piv && code_set == 1 && assoc == 1 && code_set == 1 + if (piv && code_set == 1 && assoc == 1 && proto == SCSI_PROTOCOL_SAS && type == 3 && len == 8) efd.addr = (u64)desc[4] << 56 | (u64)desc[5] << 48 | |