All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: remove scsi_to_u32
@ 2015-01-10 10:10 Christoph Hellwig
  2015-01-14 10:49 ` Bart Van Assche
  0 siblings, 1 reply; 2+ messages in thread
From: Christoph Hellwig @ 2015-01-10 10:10 UTC (permalink / raw)
  To: linux-scsi

scsi_to_u32 is a non-optimized reimplementation of get_unaligned_be32,
just use the real thing (TM).

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/scsi/libsas/sas_expander.c | 8 ++++----
 include/scsi/scsi.h                | 6 ------
 2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
index 022bb6e..01ff10f 100644
--- a/drivers/scsi/libsas/sas_expander.c
+++ b/drivers/scsi/libsas/sas_expander.c
@@ -678,10 +678,10 @@ int sas_smp_get_phy_events(struct sas_phy *phy)
 	if (!res)
 		goto out;
 
-	phy->invalid_dword_count = scsi_to_u32(&resp[12]);
-	phy->running_disparity_error_count = scsi_to_u32(&resp[16]);
-	phy->loss_of_dword_sync_count = scsi_to_u32(&resp[20]);
-	phy->phy_reset_problem_count = scsi_to_u32(&resp[24]);
+	phy->invalid_dword_count = get_unaligned_be32(&resp[12]);
+	phy->running_disparity_error_count = get_unaligned_be32(&resp[16]);
+	phy->loss_of_dword_sync_count = get_unaligned_be32(&resp[20]);
+	phy->phy_reset_problem_count = get_unaligned_be32(&resp[24]);
 
  out:
 	kfree(resp);
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index d0a66aa..42e5e49 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -585,10 +585,4 @@ static inline int scsi_is_wlun(u64 lun)
 /* Used to obtain the PCI location of a device */
 #define SCSI_IOCTL_GET_PCI		0x5387
 
-/* Pull a u32 out of a SCSI message (using BE SCSI conventions) */
-static inline __u32 scsi_to_u32(__u8 *ptr)
-{
-	return (ptr[0]<<24) + (ptr[1]<<16) + (ptr[2]<<8) + ptr[3];
-}
-
 #endif /* _SCSI_SCSI_H */
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] scsi: remove scsi_to_u32
  2015-01-10 10:10 [PATCH] scsi: remove scsi_to_u32 Christoph Hellwig
@ 2015-01-14 10:49 ` Bart Van Assche
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Van Assche @ 2015-01-14 10:49 UTC (permalink / raw)
  To: Christoph Hellwig, linux-scsi

On 01/10/15 11:10, Christoph Hellwig wrote:
> scsi_to_u32 is a non-optimized reimplementation of get_unaligned_be32,
> just use the real thing (TM).

Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-01-14 10:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-10 10:10 [PATCH] scsi: remove scsi_to_u32 Christoph Hellwig
2015-01-14 10:49 ` Bart Van Assche

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.