Re: [RFC PATCH 3/5] fsi/scom: Fixup endian annotations

2018-06-13 Thread Eddie James




On 06/12/2018 12:19 AM, Benjamin Herrenschmidt wrote:

Use the proper annotated type __be32 and fixup the
accessor used for get_scom()

Signed-off-by: Benjamin Herrenschmidt 


Reviewed-by: Eddie James 


---
  drivers/fsi/fsi-scom.c | 9 -
  1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/fsi/fsi-scom.c b/drivers/fsi/fsi-scom.c
index 8a608db0aa07..6ddfb6021420 100644
--- a/drivers/fsi/fsi-scom.c
+++ b/drivers/fsi/fsi-scom.c
@@ -51,8 +51,8 @@ static DEFINE_IDA(scom_ida);
  static int put_scom(struct scom_device *scom_dev, uint64_t value,
uint32_t addr)
  {
+   __be32 data;
int rc;
-   uint32_t data;

mutex_lock(_dev->lock);

@@ -79,7 +79,7 @@ static int put_scom(struct scom_device *scom_dev, uint64_t 
value,
  static int get_scom(struct scom_device *scom_dev, uint64_t *value,
uint32_t addr)
  {
-   uint32_t result, data;
+   __be32 result, data;
int rc;


@@ -96,14 +96,13 @@ static int get_scom(struct scom_device *scom_dev, uint64_t 
*value,
if (rc)
goto bail;

-   *value |= (uint64_t)cpu_to_be32(result) << 32;
+   *value |= (uint64_t)be32_to_cpu(result) << 32;
rc = fsi_device_read(scom_dev->fsi_dev, SCOM_DATA1_REG, ,
sizeof(uint32_t));
if (rc)
goto bail;

-   *value |= cpu_to_be32(result);
-
+   *value |= be32_to_cpu(result);
   bail:
mutex_unlock(_dev->lock);
return rc;




Re: [RFC PATCH 3/5] fsi/scom: Fixup endian annotations

2018-06-13 Thread Eddie James




On 06/12/2018 12:19 AM, Benjamin Herrenschmidt wrote:

Use the proper annotated type __be32 and fixup the
accessor used for get_scom()

Signed-off-by: Benjamin Herrenschmidt 


Reviewed-by: Eddie James 


---
  drivers/fsi/fsi-scom.c | 9 -
  1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/fsi/fsi-scom.c b/drivers/fsi/fsi-scom.c
index 8a608db0aa07..6ddfb6021420 100644
--- a/drivers/fsi/fsi-scom.c
+++ b/drivers/fsi/fsi-scom.c
@@ -51,8 +51,8 @@ static DEFINE_IDA(scom_ida);
  static int put_scom(struct scom_device *scom_dev, uint64_t value,
uint32_t addr)
  {
+   __be32 data;
int rc;
-   uint32_t data;

mutex_lock(_dev->lock);

@@ -79,7 +79,7 @@ static int put_scom(struct scom_device *scom_dev, uint64_t 
value,
  static int get_scom(struct scom_device *scom_dev, uint64_t *value,
uint32_t addr)
  {
-   uint32_t result, data;
+   __be32 result, data;
int rc;


@@ -96,14 +96,13 @@ static int get_scom(struct scom_device *scom_dev, uint64_t 
*value,
if (rc)
goto bail;

-   *value |= (uint64_t)cpu_to_be32(result) << 32;
+   *value |= (uint64_t)be32_to_cpu(result) << 32;
rc = fsi_device_read(scom_dev->fsi_dev, SCOM_DATA1_REG, ,
sizeof(uint32_t));
if (rc)
goto bail;

-   *value |= cpu_to_be32(result);
-
+   *value |= be32_to_cpu(result);
   bail:
mutex_unlock(_dev->lock);
return rc;




[RFC PATCH 3/5] fsi/scom: Fixup endian annotations

2018-06-11 Thread Benjamin Herrenschmidt
Use the proper annotated type __be32 and fixup the
accessor used for get_scom()

Signed-off-by: Benjamin Herrenschmidt 
---
 drivers/fsi/fsi-scom.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/fsi/fsi-scom.c b/drivers/fsi/fsi-scom.c
index 8a608db0aa07..6ddfb6021420 100644
--- a/drivers/fsi/fsi-scom.c
+++ b/drivers/fsi/fsi-scom.c
@@ -51,8 +51,8 @@ static DEFINE_IDA(scom_ida);
 static int put_scom(struct scom_device *scom_dev, uint64_t value,
uint32_t addr)
 {
+   __be32 data;
int rc;
-   uint32_t data;
 
mutex_lock(_dev->lock);
 
@@ -79,7 +79,7 @@ static int put_scom(struct scom_device *scom_dev, uint64_t 
value,
 static int get_scom(struct scom_device *scom_dev, uint64_t *value,
uint32_t addr)
 {
-   uint32_t result, data;
+   __be32 result, data;
int rc;
 
 
@@ -96,14 +96,13 @@ static int get_scom(struct scom_device *scom_dev, uint64_t 
*value,
if (rc)
goto bail;
 
-   *value |= (uint64_t)cpu_to_be32(result) << 32;
+   *value |= (uint64_t)be32_to_cpu(result) << 32;
rc = fsi_device_read(scom_dev->fsi_dev, SCOM_DATA1_REG, ,
sizeof(uint32_t));
if (rc)
goto bail;
 
-   *value |= cpu_to_be32(result);
-
+   *value |= be32_to_cpu(result);
  bail:
mutex_unlock(_dev->lock);
return rc;
-- 
2.17.0



[RFC PATCH 3/5] fsi/scom: Fixup endian annotations

2018-06-11 Thread Benjamin Herrenschmidt
Use the proper annotated type __be32 and fixup the
accessor used for get_scom()

Signed-off-by: Benjamin Herrenschmidt 
---
 drivers/fsi/fsi-scom.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/fsi/fsi-scom.c b/drivers/fsi/fsi-scom.c
index 8a608db0aa07..6ddfb6021420 100644
--- a/drivers/fsi/fsi-scom.c
+++ b/drivers/fsi/fsi-scom.c
@@ -51,8 +51,8 @@ static DEFINE_IDA(scom_ida);
 static int put_scom(struct scom_device *scom_dev, uint64_t value,
uint32_t addr)
 {
+   __be32 data;
int rc;
-   uint32_t data;
 
mutex_lock(_dev->lock);
 
@@ -79,7 +79,7 @@ static int put_scom(struct scom_device *scom_dev, uint64_t 
value,
 static int get_scom(struct scom_device *scom_dev, uint64_t *value,
uint32_t addr)
 {
-   uint32_t result, data;
+   __be32 result, data;
int rc;
 
 
@@ -96,14 +96,13 @@ static int get_scom(struct scom_device *scom_dev, uint64_t 
*value,
if (rc)
goto bail;
 
-   *value |= (uint64_t)cpu_to_be32(result) << 32;
+   *value |= (uint64_t)be32_to_cpu(result) << 32;
rc = fsi_device_read(scom_dev->fsi_dev, SCOM_DATA1_REG, ,
sizeof(uint32_t));
if (rc)
goto bail;
 
-   *value |= cpu_to_be32(result);
-
+   *value |= be32_to_cpu(result);
  bail:
mutex_unlock(_dev->lock);
return rc;
-- 
2.17.0