Merge 4.3-rc3 into staging-next
[firefly-linux-kernel-4.4.55.git] / drivers / staging / fbtft / fb_watterott.c
index 8eae6ef25846bfb1c6fe17365af757286e85faf3..14beefefa9acb68d081de2ffd624155528f0d1b6 100644 (file)
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
 #include <linux/module.h>
@@ -43,7 +39,6 @@
 #define COLOR_RGB233           10
 #define COLOR_RGB565           16
 
-
 static short mode = 565;
 module_param(mode, short, 0);
 MODULE_PARM_DESC(mode, "RGB color transfer mode: 332, 565 (default)");
@@ -164,8 +159,6 @@ static int init_display(struct fbtft_par *par)
        unsigned version;
        u8 save_mode;
 
-       fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__);
-
        /* enable SPI interface by having CS and MOSI low during reset */
        save_mode = par->spi->mode;
        par->spi->mode |= SPI_CS_HIGH;
@@ -205,8 +198,6 @@ static int set_var(struct fbtft_par *par)
 {
        u8 rotate;
 
-       fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__);
-
        /* this controller rotates clock wise */
        switch (par->info->var.rotate) {
        case 90:
@@ -257,31 +248,24 @@ static int backlight_chip_update_status(struct backlight_device *bd)
        return 0;
 }
 
+static const struct backlight_ops bl_ops = {
+       .update_status = backlight_chip_update_status,
+};
+
 static void register_chip_backlight(struct fbtft_par *par)
 {
        struct backlight_device *bd;
        struct backlight_properties bl_props = { 0, };
-       struct backlight_ops *bl_ops;
 
        fbtft_par_dbg(DEBUG_BACKLIGHT, par, "%s()\n", __func__);
 
-       bl_ops = devm_kzalloc(par->info->device, sizeof(struct backlight_ops),
-                               GFP_KERNEL);
-       if (!bl_ops) {
-               dev_err(par->info->device,
-                       "%s: could not allocate memory for backlight operations.\n",
-                       __func__);
-               return;
-       }
-
-       bl_ops->update_status = backlight_chip_update_status;
        bl_props.type = BACKLIGHT_RAW;
        bl_props.power = FB_BLANK_POWERDOWN;
        bl_props.max_brightness = 100;
        bl_props.brightness = DEFAULT_BRIGHTNESS;
 
        bd = backlight_device_register(dev_driver_string(par->info->device),
-                               par->info->device, par, bl_ops, &bl_props);
+                               par->info->device, par, &bl_ops, &bl_props);
        if (IS_ERR(bd)) {
                dev_err(par->info->device,
                        "cannot register backlight device (%ld)\n",
@@ -297,7 +281,6 @@ static void register_chip_backlight(struct fbtft_par *par)
 #define register_chip_backlight NULL
 #endif
 
-
 static struct fbtft_display display = {
        .regwidth = 8,
        .buswidth = 8,
@@ -315,6 +298,7 @@ static struct fbtft_display display = {
                .register_backlight = register_chip_backlight,
        },
 };
+
 FBTFT_REGISTER_DRIVER(DRVNAME, "watterott,openlcd", &display);
 
 MODULE_ALIAS("spi:" DRVNAME);