@@ -10,6 +10,7 @@
* TS-4600 SoM.
*/
+#include <linux/bitmap.h>
#include <linux/bitops.h>
#include <linux/gpio/consumer.h>
#include <linux/kernel.h>
@@ -107,7 +108,7 @@ static void ts_nbus_reset_bus(struct ts_nbus *ts_nbus)
{
DECLARE_BITMAP(values, 8);
- values[0] = 0;
+ bitmap_set_value8(values, byte, 0);
gpiod_multi_set_value_cansleep(ts_nbus->data, values);
gpiod_set_value_cansleep(ts_nbus->csn, 0);
@@ -151,7 +152,7 @@ static void ts_nbus_write_byte(struct ts_nbus *ts_nbus, u8 byte)
{
DECLARE_BITMAP(values, 8);
- values[0] = byte;
+ bitmap_set_value8(values, byte, 8);
gpiod_multi_set_value_cansleep(ts_nbus->data, values);
}
Use bitmap_get_value8() instead of accessing the bitmap directly. Accessing the bitmap directly is not considered good practice. We now have a helper function that can be used instead, so let's use it. Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: David Lechner <dlechner@baylibre.com> --- drivers/bus/ts-nbus.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)