OSDN Git Service

staging: fbtft: Remove unnecessary spi_set_drvdata()
authorAmitoj Kaur Chawla <amitoj1606@gmail.com>
Thu, 25 Feb 2016 05:37:28 +0000 (11:07 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 12 Mar 2016 06:09:09 +0000 (22:09 -0800)
Unnecessary spi_set_drvdata() has been removed since the driver
core clears the driver data to NULL after device release or on
probe failure. There is no need to manually clear the device
driver data to NULL.

The Coccinelle semantic patch used to make this change is as follows:
@@
struct spi_device *spi;
@@
- spi_set_drvdata(spi, NULL);
// </smpl>

Due to this removal, variable `spi` was unused so dropped `spi`

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/fbtft/fbtft-core.c

index 6c9cdd2..574c148 100644 (file)
@@ -985,8 +985,6 @@ int fbtft_register_framebuffer(struct fb_info *fb_info)
 reg_fail:
        if (par->fbtftops.unregister_backlight)
                par->fbtftops.unregister_backlight(par);
-       if (spi)
-               spi_set_drvdata(spi, NULL);
 
        return ret;
 }
@@ -1004,10 +1002,7 @@ EXPORT_SYMBOL(fbtft_register_framebuffer);
 int fbtft_unregister_framebuffer(struct fb_info *fb_info)
 {
        struct fbtft_par *par = fb_info->par;
-       struct spi_device *spi = par->spi;
 
-       if (spi)
-               spi_set_drvdata(spi, NULL);
        if (par->fbtftops.unregister_backlight)
                par->fbtftops.unregister_backlight(par);
        fbtft_sysfs_exit(par);