diff options
author | Matthew Wilcox <matthew@wil.cx> | 2008-12-31 14:11:17 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2009-03-12 13:57:54 -0400 |
commit | 40c3460f3cad1672f22baadcdbe20b9b3200cc20 (patch) | |
tree | 24c7d3114f7637a8930581ed79c305068b36c4ee /drivers/scsi/ses.c | |
parent | 881a256d84e658d14ca1c162fe56e9cbbb1cdd49 (diff) |
[SCSI] ses: Use new scsi VPD helper
SES had its own code to retrieve VPD from devices; convert it to use the
new scsi_get_vpd_page helper.
Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/ses.c')
-rw-r--r-- | drivers/scsi/ses.c | 31 |
1 files changed, 4 insertions, 27 deletions
diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c index e946e05db7f7..f2cf95235543 100644 --- a/drivers/scsi/ses.c +++ b/drivers/scsi/ses.c | |||
@@ -345,44 +345,21 @@ static int ses_enclosure_find_by_addr(struct enclosure_device *edev, | |||
345 | return 0; | 345 | return 0; |
346 | } | 346 | } |
347 | 347 | ||
348 | #define VPD_INQUIRY_SIZE 36 | ||
349 | |||
350 | static void ses_match_to_enclosure(struct enclosure_device *edev, | 348 | static void ses_match_to_enclosure(struct enclosure_device *edev, |
351 | struct scsi_device *sdev) | 349 | struct scsi_device *sdev) |
352 | { | 350 | { |
353 | unsigned char *buf = kmalloc(VPD_INQUIRY_SIZE, GFP_KERNEL); | 351 | unsigned char *buf; |
354 | unsigned char *desc; | 352 | unsigned char *desc; |
355 | u16 vpd_len; | 353 | unsigned int vpd_len; |
356 | struct efd efd = { | 354 | struct efd efd = { |
357 | .addr = 0, | 355 | .addr = 0, |
358 | }; | 356 | }; |
359 | unsigned char cmd[] = { | ||
360 | INQUIRY, | ||
361 | 1, | ||
362 | 0x83, | ||
363 | VPD_INQUIRY_SIZE >> 8, | ||
364 | VPD_INQUIRY_SIZE & 0xff, | ||
365 | 0 | ||
366 | }; | ||
367 | 357 | ||
358 | buf = scsi_get_vpd_page(sdev, 0x83); | ||
368 | if (!buf) | 359 | if (!buf) |
369 | return; | 360 | return; |
370 | 361 | ||
371 | if (scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buf, | 362 | vpd_len = ((buf[2] << 8) | buf[3]) + 4; |
372 | VPD_INQUIRY_SIZE, NULL, SES_TIMEOUT, SES_RETRIES, | ||
373 | NULL)) | ||
374 | goto free; | ||
375 | |||
376 | vpd_len = (buf[2] << 8) + buf[3]; | ||
377 | kfree(buf); | ||
378 | buf = kmalloc(vpd_len, GFP_KERNEL); | ||
379 | if (!buf) | ||
380 | return; | ||
381 | cmd[3] = vpd_len >> 8; | ||
382 | cmd[4] = vpd_len & 0xff; | ||
383 | if (scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buf, | ||
384 | vpd_len, NULL, SES_TIMEOUT, SES_RETRIES, NULL)) | ||
385 | goto free; | ||
386 | 363 | ||
387 | desc = buf + 4; | 364 | desc = buf + 4; |
388 | while (desc < buf + vpd_len) { | 365 | while (desc < buf + vpd_len) { |