# \[PATCH 00/11\] Drop unnecessary static

- Subsystems: FRAMEBUFFER LAYER, ARM GENERIC INTERRUPT CONTROLLER DRIVERS, ARM/MOXA ART SOC, BLOCK LAYER, CLOCKSOURCE, CLOCKEVENT DRIVERS, COMMON CLK FRAMEWORK, DRBD DRIVER, HID SENSOR HUB DRIVERS, IIO SUBSYSTEM AND DRIVERS, IRQCHIP DRIVERS, LIBATA PATA FARADAY FTIDE010 AND GEMINI SATA BRIDGE DRIVERS, LIBATA SUBSYSTEM (Serial and Parallel ATA drivers), MEMORY TECHNOLOGY DEVICES (MTD), MIPS CORE DRIVERS, MULTIFUNCTION DEVICES (MFD), OMAP2+ SUPPORT, POWER SUPPLY CLASS/SUBSYSTEM and DRIVERS, THE REST, VOLTAGE AND CURRENT REGULATOR FRAMEWORK
- Maintainers: Helge Deller, Marc Zyngier, Krzysztof Kozlowski, Jens Axboe, Daniel Lezcano, Thomas Gleixner, Stephen Boyd, Brian Masney, Jerome Brunet, Philipp Reisner, Lars Ellenberg, Christoph Böhmwalder, Jiri Kosina, Jonathan Cameron, Srinivas Pandruvada, Linus Walleij, Damien Le Moal, Niklas Cassel, Miquel Raynal, Richard Weinberger, Vignesh Raghavendra, Thomas Bogendoerfer, Lee Jones, Aaro Koskinen, Andreas Kemnade, Kevin Hilman, Roger Quadros, Tony Lindgren, Sebastian Reichel, Linus Torvalds, Liam Girdwood, Mark Brown
- Series: 11 patches touching 10 files, +11/-11
- List: linux-fbdev
- 5 messages, 3 authors
- Page: https://ratatoskr.run/linux-fbdev/2017/07/5043396/t

## \[PATCH 00/11\] Drop unnecessary static

- From: Julia Lawall \<hidden\>
- Date: 2017-07-15 20:34:47 
- Message: https://ratatoskr.run/linux-fbdev/2017/07/5043396.md

```text
These patches fix cases where there is a static on a local variable, but
the variable is initialized before any possible use.  Thus, the static has
no benefit.

---

 drivers/ata/sata_gemini.c                     |    2 +-
 drivers/clk/clk-moxart.c                      |    4 ++--
 drivers/clk/mmp/clk.c                         |    2 +-
 drivers/iio/orientation/hid-sensor-rotation.c |    2 +-
 drivers/irqchip/irq-digicolor.c               |    2 +-
 drivers/irqchip/irq-gic-realview.c            |    2 +-
 drivers/irqchip/irq-mips-cpu.c                |    2 +-
 drivers/mfd/max8925-i2c.c                     |    2 +-
 drivers/mfd/twl4030-irq.c                     |    2 +-
 drivers/mtd/maps/physmap_of_versatile.c       |    2 +-
 drivers/video/fbdev/da8xx-fb.c                |    2 +-
 11 files changed, 12 insertions(+), 12 deletions(-)
```

## \[PATCH 04/11\] fbdev: da8xx-fb: Drop unnecessary static

- From: Julia Lawall \<hidden\>
- Date: 2017-07-15 20:35:12 
- Message: https://ratatoskr.run/linux-fbdev/2017/07/5043398.md

```text
Drop static on a local variable, when the variable is initialized before
any possible use.  Thus, the static has no benefit.

The semantic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@bad exists@
position p;
identifier x;
type T;
@@
static T x@p;
...
x = <+...x...+>

@@
identifier x;
expression e;
type T;
position p != bad.p;
@@
-static
 T x@p;
 ... when != x
     when strict
?x = e;
// </smpl>

Signed-off-by: Julia Lawall <redacted>

---
These patches are all independent of each other.

 drivers/video/fbdev/da8xx-fb.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -u -p a/drivers/video/fbdev/da8xx-fb.c b/drivers/video/fbdev/da8xx-fb.c
--- a/drivers/video/fbdev/da8xx-fb.c
+++ b/drivers/video/fbdev/da8xx-fb.c
@@ -1341,7 +1341,7 @@ static int fb_probe(struct platform_devi
 {
 	struct da8xx_lcdc_platform_data *fb_pdata  						dev_get_platdata(&device->dev);
-	static struct resource *lcdc_regs;
+	struct resource *lcdc_regs;
 	struct lcd_ctrl_config *lcd_cfg;
 	struct fb_videomode *lcdc_info;
 	struct fb_info *da8xx_fb_info;

```

## Re: \[PATCH 00/11\] Drop unnecessary static

- From: Joe Perches \<joe@perches.com\>
- Date: 2017-07-15 20:38:06 
- Message: https://ratatoskr.run/linux-fbdev/2017/07/5043400.md

```text
On Sat, 2017-07-15 at 22:07 +0200, Julia Lawall wrote:
> These patches fix cases where there is a static on a local variable, but
> the variable is initialized before any possible use.  Thus, the static has
> no benefit.

Nice one.

```

## Re: \[PATCH 00/11\] Drop unnecessary static

- From: Julia Lawall \<hidden\>
- Date: 2017-07-15 21:00:42 
- Message: https://ratatoskr.run/linux-fbdev/2017/07/5043406.md

```text


On Sat, 15 Jul 2017, Joe Perches wrote:

> On Sat, 2017-07-15 at 22:07 +0200, Julia Lawall wrote:
> > These patches fix cases where there is a static on a local variable, but
> > the variable is initialized before any possible use.  Thus, the static has
> > no benefit.
>
> Nice one.

Thanks.  It was suggested by Kees Cook a while ago.  There seem to be many
opportunities.

julia
```

## Re: \[PATCH 04/11\] fbdev: da8xx-fb: Drop unnecessary static

- From: Bartlomiej Zolnierkiewicz \<hidden\>
- Date: 2017-08-01 13:10:04 
- Message: https://ratatoskr.run/linux-fbdev/2017/08/5056590.md

```text
On Saturday, July 15, 2017 10:07:39 PM Julia Lawall wrote:
> Drop static on a local variable, when the variable is initialized before
> any possible use.  Thus, the static has no benefit.
> 
> The semantic patch that fixes this problem is as follows:
> (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @bad exists@
> position p;
> identifier x;
> type T;
> @@
> static T x@p;
> ...
> x = <+...x...+>
> 
> @@
> identifier x;
> expression e;
> type T;
> position p != bad.p;
> @@
> -static
>  T x@p;
>  ... when != x
>      when strict
> ?x = e;
> // </smpl>
> 
> Signed-off-by: Julia Lawall <redacted>

Patch queued for 4.14, thanks.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

```
