staging: fbtft: use helper fbtft_write_buf_dc in fbtft-bus.c
authorHeiner Kallweit <hkallweit1@gmail.com>
Thu, 2 Mar 2017 21:19:00 +0000 (22:19 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Mar 2017 16:33:18 +0000 (17:33 +0100)
Make use of new helper fbtft_write_buf_dc.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/fbtft/fbtft-bus.c

index ec45043c08302286f83bd413075af5478e9a28f2..3475b1b8081f802d3beeaccd396244d0b5b83183 100644 (file)
@@ -36,14 +36,9 @@ void func(struct fbtft_par *par, int len, ...)                                \
        }                                                                     \
                                                                              \
        *buf = modifier((type)va_arg(args, unsigned int));                    \
-       if (par->gpio.dc != -1)                                               \
-               gpio_set_value(par->gpio.dc, 0);                              \
-       ret = par->fbtftops.write(par, par->buf, sizeof(type) + offset);      \
-       if (ret < 0) {                                                        \
-               va_end(args);                                                 \
-               dev_err(par->info->device, "%s: write() failed and returned %d\n", __func__, ret); \
-               return;                                                       \
-       }                                                                     \
+       ret = fbtft_write_buf_dc(par, par->buf, sizeof(type) + offset, 0);    \
+       if (ret < 0)                                                          \
+               goto out;                                                     \
        len--;                                                                \
                                                                              \
        if (par->startbyte)                                                   \
@@ -51,19 +46,12 @@ void func(struct fbtft_par *par, int len, ...)                                \
                                                                              \
        if (len) {                                                            \
                i = len;                                                      \
-               while (i--) {                                                 \
+               while (i--)                                                   \
                        *buf++ = modifier((type)va_arg(args, unsigned int));  \
-               }                                                             \
-               if (par->gpio.dc != -1)                                       \
-                       gpio_set_value(par->gpio.dc, 1);                      \
-               ret = par->fbtftops.write(par, par->buf,                      \
-                                         len * (sizeof(type) + offset));     \
-               if (ret < 0) {                                                \
-                       va_end(args);                                         \
-                       dev_err(par->info->device, "%s: write() failed and returned %d\n", __func__, ret); \
-                       return;                                               \
-               }                                                             \
+               fbtft_write_buf_dc(par, par->buf,                             \
+                                  len * (sizeof(type) + offset), 1);         \
        }                                                                     \
+out:                                                                         \
        va_end(args);                                                         \
 }                                                                             \
 EXPORT_SYMBOL(func);
@@ -243,10 +231,7 @@ int fbtft_write_vmem16_bus16(struct fbtft_par *par, size_t offset, size_t len)
 
        vmem16 = (u16 *)(par->info->screen_buffer + offset);
 
-       if (par->gpio.dc != -1)
-               gpio_set_value(par->gpio.dc, 1);
-
        /* no need for buffered write with 16-bit bus */
-       return par->fbtftops.write(par, vmem16, len);
+       return fbtft_write_buf_dc(par, vmem16, len, 1);
 }
 EXPORT_SYMBOL(fbtft_write_vmem16_bus16);