diff options
author | Sven Van Asbroeck <thesven73@gmail.com> | 2019-04-30 11:25:14 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-04-30 17:40:34 +0200 |
commit | be7d6b03602eb0d3dccae0bbce4c796526c51661 (patch) | |
tree | 582cacc61eff89e6541d479d977c22b796061df9 /drivers | |
parent | d5d66cfea2ca281d53e63360b459f84b5fff5e12 (diff) |
staging: fieldbus: anybus-s: keep device bus id in bus endianness
"Normal" bus structures such as USB or PCI keep device bus ids
in bus endinanness, and driver bus ids in host endianness.
Endianness conversion happens each time bus_match() is called.
Modify anybus-s to conform to this pattern. As a pleasant side-
effect, sparse warnings will now disappear.
This was suggested by Al Viro.
Link: https://lkml.org/lkml/2019/4/30/834
Signed-off-by: Sven Van Asbroeck <TheSven73@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/fieldbus/anybuss/anybuss-client.h | 2 | ||||
-rw-r--r-- | drivers/staging/fieldbus/anybuss/host.c | 7 |
2 files changed, 4 insertions, 5 deletions
diff --git a/drivers/staging/fieldbus/anybuss/anybuss-client.h b/drivers/staging/fieldbus/anybuss/anybuss-client.h index 2e48fb8f0209..dce60f86c16f 100644 --- a/drivers/staging/fieldbus/anybuss/anybuss-client.h +++ b/drivers/staging/fieldbus/anybuss/anybuss-client.h @@ -17,7 +17,7 @@ struct anybuss_host; struct anybuss_client { struct device dev; struct anybuss_host *host; - u16 fieldbus_type; + __be16 fieldbus_type; /* * these can be optionally set by the client to receive event * notifications from the host. diff --git a/drivers/staging/fieldbus/anybuss/host.c b/drivers/staging/fieldbus/anybuss/host.c index e34d4249f5a7..a153b0fde963 100644 --- a/drivers/staging/fieldbus/anybuss/host.c +++ b/drivers/staging/fieldbus/anybuss/host.c @@ -1173,7 +1173,7 @@ static int anybus_bus_match(struct device *dev, struct anybuss_client *adev = to_anybuss_client(dev); - return adrv->fieldbus_type == adev->fieldbus_type; + return adrv->fieldbus_type == be16_to_cpu(adev->fieldbus_type); } static int anybus_bus_probe(struct device *dev) @@ -1264,7 +1264,7 @@ anybuss_host_common_probe(struct device *dev, { int ret, i; u8 val[4]; - u16 fieldbus_type; + __be16 fieldbus_type; struct anybuss_host *cd; cd = devm_kzalloc(dev, sizeof(*cd), GFP_KERNEL); @@ -1348,8 +1348,7 @@ anybuss_host_common_probe(struct device *dev, add_device_randomness(&val, 4); regmap_bulk_read(cd->regmap, REG_FIELDBUS_TYPE, &fieldbus_type, sizeof(fieldbus_type)); - fieldbus_type = be16_to_cpu(fieldbus_type); - dev_info(dev, "Fieldbus type: %04X", fieldbus_type); + dev_info(dev, "Fieldbus type: %04X", be16_to_cpu(fieldbus_type)); regmap_bulk_read(cd->regmap, REG_MODULE_SW_V, val, 2); dev_info(dev, "Module SW version: %02X%02X", val[0], val[1]); |