diff mbox

[Vivid,SRU] UBUNTU: SAUCE: ipr: Byte swapping for device_id attribute in sysfs

Message ID 1440687187-20878-1-git-send-email-tim.gardner@canonical.com
State New
Headers show

Commit Message

Tim Gardner Aug. 27, 2015, 2:53 p.m. UTC
From: Wen Xiong <wenxiong@linux.vnet.ibm.com>

BugLink: http://bugs.launchpad.net/bugs/1453892

Upstream

On LE system, users see the wrong device_id attribute. This patch
does necessary byte swapping for device_id attribute and works on
both of LE and BE systems.

Signed-off-by: Wen Xiong <wenxiong@linux.vnet.ibm.com>
Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
(cherry picked from linux-next commit bb8647e86e769bd45d2d5e010b3af516210d5760)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
 drivers/scsi/ipr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Seth Forshee Aug. 27, 2015, 3:16 p.m. UTC | #1

Brad Figg Aug. 27, 2015, 3:20 p.m. UTC | #2
On Thu, Aug 27, 2015 at 08:53:07AM -0600, tim.gardner@canonical.com wrote:
> From: Wen Xiong <wenxiong@linux.vnet.ibm.com>
> 
> BugLink: http://bugs.launchpad.net/bugs/1453892
> 
> Upstream
> 
> On LE system, users see the wrong device_id attribute. This patch
> does necessary byte swapping for device_id attribute and works on
> both of LE and BE systems.
> 
> Signed-off-by: Wen Xiong <wenxiong@linux.vnet.ibm.com>
> Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
> Signed-off-by: James Bottomley <JBottomley@Odin.com>
> (cherry picked from linux-next commit bb8647e86e769bd45d2d5e010b3af516210d5760)
> Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
> ---
>  drivers/scsi/ipr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
> index 9219953..b8171cc 100644
> --- a/drivers/scsi/ipr.c
> +++ b/drivers/scsi/ipr.c
> @@ -4440,7 +4440,7 @@ static ssize_t ipr_show_device_id(struct device *dev, struct device_attribute *a
>  	spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
>  	res = (struct ipr_resource_entry *)sdev->hostdata;
>  	if (res && ioa_cfg->sis64)
> -		len = snprintf(buf, PAGE_SIZE, "0x%llx\n", res->dev_id);
> +		len = snprintf(buf, PAGE_SIZE, "0x%llx\n", be64_to_cpu(res->dev_id));
>  	else if (res)
>  		len = snprintf(buf, PAGE_SIZE, "0x%llx\n", res->lun_wwn);
>  
> -- 
> 1.9.1
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team

Looks good.
Brad Figg Aug. 27, 2015, 3:25 p.m. UTC | #3
Applied to the master-next branch of Vivid.
diff mbox

Patch

diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 9219953..b8171cc 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -4440,7 +4440,7 @@  static ssize_t ipr_show_device_id(struct device *dev, struct device_attribute *a
 	spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
 	res = (struct ipr_resource_entry *)sdev->hostdata;
 	if (res && ioa_cfg->sis64)
-		len = snprintf(buf, PAGE_SIZE, "0x%llx\n", res->dev_id);
+		len = snprintf(buf, PAGE_SIZE, "0x%llx\n", be64_to_cpu(res->dev_id));
 	else if (res)
 		len = snprintf(buf, PAGE_SIZE, "0x%llx\n", res->lun_wwn);