diff options
| author | Hannes Reinecke <hare@suse.de> | 2015-12-01 04:16:58 -0500 |
|---|---|---|
| committer | Martin K. Petersen <martin.petersen@oracle.com> | 2015-12-02 16:59:01 -0500 |
| commit | 83ea0e5e3501decac0afdff25bba2ca1e78f79cc (patch) | |
| tree | bdeced2359c11d6c615f81f3272ef4834d8896bd /drivers/scsi/device_handler | |
| parent | a8aa3978588a4fa2d9edabc151adedd97bbed091 (diff) | |
scsi_dh_alua: use scsi_vpd_tpg_id()
Use the common function 'scsi_vpd_tpg_id()' instead of open-coding
it in scsi_dh_alua.
[mkp: Applied by hand]
Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/device_handler')
| -rw-r--r-- | drivers/scsi/device_handler/scsi_dh_alua.c | 37 |
1 files changed, 6 insertions, 31 deletions
diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c index 39654b1703b3..f100cbb7d2e1 100644 --- a/drivers/scsi/device_handler/scsi_dh_alua.c +++ b/drivers/scsi/device_handler/scsi_dh_alua.c | |||
| @@ -322,36 +322,10 @@ static int alua_check_vpd(struct scsi_device *sdev, struct alua_dh_data *h) | |||
| 322 | { | 322 | { |
| 323 | unsigned char *d; | 323 | unsigned char *d; |
| 324 | unsigned char __rcu *vpd_pg83; | 324 | unsigned char __rcu *vpd_pg83; |
| 325 | int rel_port = -1, group_id; | ||
| 325 | 326 | ||
| 326 | rcu_read_lock(); | 327 | group_id = scsi_vpd_tpg_id(sdev, &rel_port); |
| 327 | if (!rcu_dereference(sdev->vpd_pg83)) { | 328 | if (group_id < 0) { |
| 328 | rcu_read_unlock(); | ||
| 329 | return SCSI_DH_DEV_UNSUPP; | ||
| 330 | } | ||
| 331 | |||
| 332 | /* | ||
| 333 | * Look for the correct descriptor. | ||
| 334 | */ | ||
| 335 | vpd_pg83 = rcu_dereference(sdev->vpd_pg83); | ||
| 336 | d = vpd_pg83 + 4; | ||
| 337 | while (d < vpd_pg83 + sdev->vpd_pg83_len) { | ||
| 338 | switch (d[1] & 0xf) { | ||
| 339 | case 0x4: | ||
| 340 | /* Relative target port */ | ||
| 341 | h->rel_port = get_unaligned_be16(&d[6]); | ||
| 342 | break; | ||
| 343 | case 0x5: | ||
| 344 | /* Target port group */ | ||
| 345 | h->group_id = get_unaligned_be16(&d[6]); | ||
| 346 | break; | ||
| 347 | default: | ||
| 348 | break; | ||
| 349 | } | ||
| 350 | d += d[3] + 4; | ||
| 351 | } | ||
| 352 | rcu_read_unlock(); | ||
| 353 | |||
| 354 | if (h->group_id == -1) { | ||
| 355 | /* | 329 | /* |
| 356 | * Internal error; TPGS supported but required | 330 | * Internal error; TPGS supported but required |
| 357 | * VPD identification descriptors not present. | 331 | * VPD identification descriptors not present. |
| @@ -360,10 +334,11 @@ static int alua_check_vpd(struct scsi_device *sdev, struct alua_dh_data *h) | |||
| 360 | sdev_printk(KERN_INFO, sdev, | 334 | sdev_printk(KERN_INFO, sdev, |
| 361 | "%s: No target port descriptors found\n", | 335 | "%s: No target port descriptors found\n", |
| 362 | ALUA_DH_NAME); | 336 | ALUA_DH_NAME); |
| 363 | h->state = TPGS_STATE_OPTIMIZED; | ||
| 364 | h->tpgs = TPGS_MODE_NONE; | ||
| 365 | return SCSI_DH_DEV_UNSUPP; | 337 | return SCSI_DH_DEV_UNSUPP; |
| 366 | } | 338 | } |
| 339 | h->state = TPGS_STATE_OPTIMIZED; | ||
| 340 | h->group_id = group_id; | ||
| 341 | |||
| 367 | sdev_printk(KERN_INFO, sdev, | 342 | sdev_printk(KERN_INFO, sdev, |
| 368 | "%s: port group %02x rel port %02x\n", | 343 | "%s: port group %02x rel port %02x\n", |
| 369 | ALUA_DH_NAME, h->group_id, h->rel_port); | 344 | ALUA_DH_NAME, h->group_id, h->rel_port); |
