public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH RESEND 14/18] megaraid_sas : move endianess conversion into caller of megasas_get_seq_num
@ 2015-04-20 12:34 Sumit.Saxena
  2015-04-21 10:30 ` Hannes Reinecke
  2015-04-21 12:19 ` Tomas Henzl
  0 siblings, 2 replies; 3+ messages in thread
From: Sumit.Saxena @ 2015-04-20 12:34 UTC (permalink / raw)
  To: linux-scsi
  Cc: thenzl, martin.petersen, hch, jbottomley, kashyap.desai,
	sumit.saxena

Converting structure fields in place is always a bad idea, and in this case
by moving it into the only caller we also only have to do a single byte
swap as most fields of this structure are never used.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/scsi/megaraid/megaraid_sas_base.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index cb34b48..67b9de8 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -4868,11 +4868,11 @@ megasas_get_seq_num(struct megasas_instance *instance,
 		/*
 		 * Copy the data back into callers buffer
 		 */
-		eli->newest_seq_num = le32_to_cpu(el_info->newest_seq_num);
-		eli->oldest_seq_num = le32_to_cpu(el_info->oldest_seq_num);
-		eli->clear_seq_num = le32_to_cpu(el_info->clear_seq_num);
-		eli->shutdown_seq_num = le32_to_cpu(el_info->shutdown_seq_num);
-		eli->boot_seq_num = le32_to_cpu(el_info->boot_seq_num);
+		eli->newest_seq_num = el_info->newest_seq_num;
+		eli->oldest_seq_num = el_info->oldest_seq_num;
+		eli->clear_seq_num = el_info->clear_seq_num;
+		eli->shutdown_seq_num = el_info->shutdown_seq_num;
+		eli->boot_seq_num = el_info->boot_seq_num;
 	}
 
 	pci_free_consistent(instance->pdev, sizeof(struct megasas_evt_log_info),
@@ -5032,7 +5032,7 @@ static int megasas_start_aen(struct megasas_instance *instance)
 	class_locale.members.class = MR_EVT_CLASS_DEBUG;
 
 	return megasas_register_aen(instance,
-			eli.newest_seq_num + 1,
+			le32_to_cpu(eli.newest_seq_num) + 1,
 			class_locale.word);
 }
 
-- 
1.7.1


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

* Re: [PATCH RESEND 14/18] megaraid_sas : move endianess conversion into caller of megasas_get_seq_num
  2015-04-20 12:34 [PATCH RESEND 14/18] megaraid_sas : move endianess conversion into caller of megasas_get_seq_num Sumit.Saxena
@ 2015-04-21 10:30 ` Hannes Reinecke
  2015-04-21 12:19 ` Tomas Henzl
  1 sibling, 0 replies; 3+ messages in thread
From: Hannes Reinecke @ 2015-04-21 10:30 UTC (permalink / raw)
  To: Sumit.Saxena, linux-scsi
  Cc: thenzl, martin.petersen, hch, jbottomley, kashyap.desai

On 04/20/2015 02:34 PM, Sumit.Saxena@avagotech.com wrote:
> Converting structure fields in place is always a bad idea, and in this case
> by moving it into the only caller we also only have to do a single byte
> swap as most fields of this structure are never used.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		      zSeries & Storage
hare@suse.de			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH RESEND 14/18] megaraid_sas : move endianess conversion into caller of megasas_get_seq_num
  2015-04-20 12:34 [PATCH RESEND 14/18] megaraid_sas : move endianess conversion into caller of megasas_get_seq_num Sumit.Saxena
  2015-04-21 10:30 ` Hannes Reinecke
@ 2015-04-21 12:19 ` Tomas Henzl
  1 sibling, 0 replies; 3+ messages in thread
From: Tomas Henzl @ 2015-04-21 12:19 UTC (permalink / raw)
  To: Sumit.Saxena, linux-scsi; +Cc: martin.petersen, hch, jbottomley, kashyap.desai

On 04/20/2015 02:34 PM, Sumit.Saxena@avagotech.com wrote:
> Converting structure fields in place is always a bad idea, and in this case
> by moving it into the only caller we also only have to do a single byte
> swap as most fields of this structure are never used.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Tomas Henzl <thenzl@redhat.com>

Tomas


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

end of thread, other threads:[~2015-04-21 12:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-20 12:34 [PATCH RESEND 14/18] megaraid_sas : move endianess conversion into caller of megasas_get_seq_num Sumit.Saxena
2015-04-21 10:30 ` Hannes Reinecke
2015-04-21 12:19 ` Tomas Henzl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox