Skip to content

Commit

Permalink
gpio/pinctrl: make gpio_chip members typed boolean
Browse files Browse the repository at this point in the history
This switches the two members of struct gpio_chip that were
defined as unsigned foo:1 to bool, because that is indeed what
they are. Switch all users in the gpio and pinctrl subsystems
to assign these values with true/false instead of 0/1. The
users outside these subsystems will survive since true/false
is 1/0, atleast we set some kind of more strict typing example.

Signed-off-by: Linus Walleij <[email protected]>
  • Loading branch information
linusw committed Dec 4, 2013
1 parent b7d0a28 commit 9fb1f39
Show file tree
Hide file tree
Showing 55 changed files with 65 additions and 64 deletions.
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-74x164.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ static int gen_74x164_probe(struct spi_device *spi)
goto exit_destroy;
}

chip->gpio_chip.can_sleep = 1;
chip->gpio_chip.can_sleep = true;
chip->gpio_chip.dev = &spi->dev;
chip->gpio_chip.owner = THIS_MODULE;

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-adnp.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ static int adnp_gpio_setup(struct adnp *adnp, unsigned int num_gpios)
chip->direction_output = adnp_gpio_direction_output;
chip->get = adnp_gpio_get;
chip->set = adnp_gpio_set;
chip->can_sleep = 1;
chip->can_sleep = true;

if (IS_ENABLED(CONFIG_DEBUG_FS))
chip->dbg_show = adnp_gpio_dbg_show;
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-adp5520.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ static int adp5520_gpio_probe(struct platform_device *pdev)
gc->direction_output = adp5520_gpio_direction_output;
gc->get = adp5520_gpio_get_value;
gc->set = adp5520_gpio_set_value;
gc->can_sleep = 1;
gc->can_sleep = true;

gc->base = pdata->gpio_start;
gc->ngpio = gpios;
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-adp5588.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ static int adp5588_gpio_probe(struct i2c_client *client,
gc->direction_output = adp5588_gpio_direction_output;
gc->get = adp5588_gpio_get_value;
gc->set = adp5588_gpio_set_value;
gc->can_sleep = 1;
gc->can_sleep = true;

gc->base = pdata->gpio_start;
gc->ngpio = ADP5588_MAXGPIO;
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-arizona.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ static struct gpio_chip template_chip = {
.get = arizona_gpio_get,
.direction_output = arizona_gpio_direction_out,
.set = arizona_gpio_set,
.can_sleep = 1,
.can_sleep = true,
};

static int arizona_gpio_probe(struct platform_device *pdev)
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-bt8xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ static void bt8xxgpio_gpio_setup(struct bt8xxgpio *bg)
c->dbg_show = NULL;
c->base = modparam_gpiobase;
c->ngpio = BT8XXGPIO_NR_GPIOS;
c->can_sleep = 0;
c->can_sleep = false;
}

static int bt8xxgpio_probe(struct pci_dev *dev,
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-da9052.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ static struct gpio_chip reference_gp = {
.direction_input = da9052_gpio_direction_input,
.direction_output = da9052_gpio_direction_output,
.to_irq = da9052_gpio_to_irq,
.can_sleep = 1,
.can_sleep = true,
.ngpio = 16,
.base = -1,
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-da9055.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ static struct gpio_chip reference_gp = {
.direction_input = da9055_gpio_direction_input,
.direction_output = da9055_gpio_direction_output,
.to_irq = da9055_gpio_to_irq,
.can_sleep = 1,
.can_sleep = true,
.ngpio = 3,
.base = -1,
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-ich.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ static void ichx_gpiolib_setup(struct gpio_chip *chip)
chip->direction_output = ichx_gpio_direction_output;
chip->base = modparam_gpiobase;
chip->ngpio = ichx_priv.desc->ngpio;
chip->can_sleep = 0;
chip->can_sleep = false;
chip->dbg_show = NULL;
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-intel-mid.c
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ static int intel_gpio_probe(struct pci_dev *pdev,
priv->chip.to_irq = intel_gpio_to_irq;
priv->chip.base = gpio_base;
priv->chip.ngpio = ddata->ngpio;
priv->chip.can_sleep = 0;
priv->chip.can_sleep = false;
priv->pdev = pdev;

spin_lock_init(&priv->lock);
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-kempld.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ static int kempld_gpio_probe(struct platform_device *pdev)
chip->label = "gpio-kempld";
chip->owner = THIS_MODULE;
chip->dev = dev;
chip->can_sleep = 1;
chip->can_sleep = true;
if (pdata && pdata->gpio_base)
chip->base = pdata->gpio_base;
else
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-ks8695.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ static struct gpio_chip ks8695_gpio_chip = {
.to_irq = ks8695_gpio_to_irq,
.base = 0,
.ngpio = 16,
.can_sleep = 0,
.can_sleep = false,
};

/* Register the GPIOs */
Expand Down
12 changes: 6 additions & 6 deletions drivers/gpio/gpio-lpc32xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ static struct lpc32xx_gpio_chip lpc32xx_gpiochip[] = {
.base = LPC32XX_GPIO_P0_GRP,
.ngpio = LPC32XX_GPIO_P0_MAX,
.names = gpio_p0_names,
.can_sleep = 0,
.can_sleep = false,
},
.gpio_grp = &gpio_grp_regs_p0,
},
Expand All @@ -464,7 +464,7 @@ static struct lpc32xx_gpio_chip lpc32xx_gpiochip[] = {
.base = LPC32XX_GPIO_P1_GRP,
.ngpio = LPC32XX_GPIO_P1_MAX,
.names = gpio_p1_names,
.can_sleep = 0,
.can_sleep = false,
},
.gpio_grp = &gpio_grp_regs_p1,
},
Expand All @@ -479,7 +479,7 @@ static struct lpc32xx_gpio_chip lpc32xx_gpiochip[] = {
.base = LPC32XX_GPIO_P2_GRP,
.ngpio = LPC32XX_GPIO_P2_MAX,
.names = gpio_p2_names,
.can_sleep = 0,
.can_sleep = false,
},
.gpio_grp = &gpio_grp_regs_p2,
},
Expand All @@ -495,7 +495,7 @@ static struct lpc32xx_gpio_chip lpc32xx_gpiochip[] = {
.base = LPC32XX_GPIO_P3_GRP,
.ngpio = LPC32XX_GPIO_P3_MAX,
.names = gpio_p3_names,
.can_sleep = 0,
.can_sleep = false,
},
.gpio_grp = &gpio_grp_regs_p3,
},
Expand All @@ -509,7 +509,7 @@ static struct lpc32xx_gpio_chip lpc32xx_gpiochip[] = {
.base = LPC32XX_GPI_P3_GRP,
.ngpio = LPC32XX_GPI_P3_MAX,
.names = gpi_p3_names,
.can_sleep = 0,
.can_sleep = false,
},
.gpio_grp = &gpio_grp_regs_p3,
},
Expand All @@ -523,7 +523,7 @@ static struct lpc32xx_gpio_chip lpc32xx_gpiochip[] = {
.base = LPC32XX_GPO_P3_GRP,
.ngpio = LPC32XX_GPO_P3_MAX,
.names = gpo_p3_names,
.can_sleep = 0,
.can_sleep = false,
},
.gpio_grp = &gpio_grp_regs_p3,
},
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-lynxpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ static int lp_gpio_probe(struct platform_device *pdev)
gc->set = lp_gpio_set;
gc->base = -1;
gc->ngpio = LP_NUM_GPIO;
gc->can_sleep = 0;
gc->can_sleep = false;
gc->dev = dev;

/* set up interrupts */
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-max730x.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ int __max730x_probe(struct max7301 *ts)
ts->chip.set = max7301_set;

ts->chip.ngpio = PIN_NUMBER;
ts->chip.can_sleep = 1;
ts->chip.can_sleep = true;
ts->chip.dev = dev;
ts->chip.owner = THIS_MODULE;

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-max732x.c
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ static int max732x_setup_gpio(struct max732x_chip *chip,
gc->set = max732x_gpio_set_value;
}
gc->get = max732x_gpio_get_value;
gc->can_sleep = 1;
gc->can_sleep = true;

gc->base = gpio_start;
gc->ngpio = port;
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-mc33880.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ static int mc33880_probe(struct spi_device *spi)
mc->chip.set = mc33880_set;
mc->chip.base = pdata->base;
mc->chip.ngpio = PIN_NUMBER;
mc->chip.can_sleep = 1;
mc->chip.can_sleep = true;
mc->chip.dev = &spi->dev;
mc->chip.owner = THIS_MODULE;

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-mc9s08dz60.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ static int mc9s08dz60_probe(struct i2c_client *client,
mc9s->chip.dev = &client->dev;
mc9s->chip.owner = THIS_MODULE;
mc9s->chip.ngpio = GPIO_NUM;
mc9s->chip.can_sleep = 1;
mc9s->chip.can_sleep = true;
mc9s->chip.get = mc9s08dz60_get_value;
mc9s->chip.set = mc9s08dz60_set_value;
mc9s->chip.direction_output = mc9s08dz60_direction_output;
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-mcp23s08.c
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev,
}

mcp->chip.base = base;
mcp->chip.can_sleep = 1;
mcp->chip.can_sleep = true;
mcp->chip.dev = dev;
mcp->chip.owner = THIS_MODULE;

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-ml-ioh.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ static void ioh_gpio_setup(struct ioh_gpio *chip, int num_port)
gpio->dbg_show = NULL;
gpio->base = -1;
gpio->ngpio = num_port;
gpio->can_sleep = 0;
gpio->can_sleep = false;
gpio->to_irq = ioh_gpio_to_irq;
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-msic.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ static int platform_msic_gpio_probe(struct platform_device *pdev)
mg->chip.to_irq = msic_gpio_to_irq;
mg->chip.base = pdata->gpio_base;
mg->chip.ngpio = MSIC_NUM_GPIO;
mg->chip.can_sleep = 1;
mg->chip.can_sleep = true;
mg->chip.dev = dev;

mutex_init(&mg->buslock);
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-mvebu.c
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
mvchip->chip.to_irq = mvebu_gpio_to_irq;
mvchip->chip.base = id * MVEBU_MAX_GPIO_PER_BANK;
mvchip->chip.ngpio = ngpios;
mvchip->chip.can_sleep = 0;
mvchip->chip.can_sleep = false;
mvchip->chip.of_node = np;
mvchip->chip.dbg_show = mvebu_gpio_dbg_show;

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-octeon.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ static int octeon_gpio_probe(struct platform_device *pdev)
chip->dev = &pdev->dev;
chip->owner = THIS_MODULE;
chip->base = 0;
chip->can_sleep = 0;
chip->can_sleep = false;
chip->ngpio = 20;
chip->direction_input = octeon_gpio_dir_in;
chip->get = octeon_gpio_get;
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-palmas.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ static int palmas_gpio_probe(struct platform_device *pdev)
palmas_gpio->gpio_chip.owner = THIS_MODULE;
palmas_gpio->gpio_chip.label = dev_name(&pdev->dev);
palmas_gpio->gpio_chip.ngpio = dev_data->ngpio;
palmas_gpio->gpio_chip.can_sleep = 1;
palmas_gpio->gpio_chip.can_sleep = true;
palmas_gpio->gpio_chip.direction_input = palmas_gpio_input;
palmas_gpio->gpio_chip.direction_output = palmas_gpio_output;
palmas_gpio->gpio_chip.to_irq = palmas_gpio_to_irq;
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-pca953x.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ static void pca953x_setup_gpio(struct pca953x_chip *chip, int gpios)
gc->direction_output = pca953x_gpio_direction_output;
gc->get = pca953x_gpio_get_value;
gc->set = pca953x_gpio_set_value;
gc->can_sleep = 1;
gc->can_sleep = true;

gc->base = chip->gpio_start;
gc->ngpio = gpios;
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-pcf857x.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ static int pcf857x_probe(struct i2c_client *client,
spin_lock_init(&gpio->slock);

gpio->chip.base = pdata ? pdata->gpio_base : -1;
gpio->chip.can_sleep = 1;
gpio->chip.can_sleep = true;
gpio->chip.dev = &client->dev;
gpio->chip.owner = THIS_MODULE;
gpio->chip.get = pcf857x_get;
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-pch.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ static void pch_gpio_setup(struct pch_gpio *chip)
gpio->dbg_show = NULL;
gpio->base = -1;
gpio->ngpio = gpio_pins[chip->ioh];
gpio->can_sleep = 0;
gpio->can_sleep = false;
gpio->to_irq = pch_gpio_to_irq;
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-rc5t583.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ static int rc5t583_gpio_probe(struct platform_device *pdev)
rc5t583_gpio->gpio_chip.get = rc5t583_gpio_get,
rc5t583_gpio->gpio_chip.to_irq = rc5t583_gpio_to_irq,
rc5t583_gpio->gpio_chip.ngpio = RC5T583_MAX_GPIO,
rc5t583_gpio->gpio_chip.can_sleep = 1,
rc5t583_gpio->gpio_chip.can_sleep = true,
rc5t583_gpio->gpio_chip.dev = &pdev->dev;
rc5t583_gpio->gpio_chip.base = -1;
rc5t583_gpio->rc5t583 = rc5t583;
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-sta2x11.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ static void gsta_gpio_setup(struct gsta_gpio *chip) /* called from probe */
gpio->dbg_show = NULL;
gpio->base = gpio_base;
gpio->ngpio = GSTA_NR_GPIO;
gpio->can_sleep = 0;
gpio->can_sleep = false;
gpio->to_irq = gsta_gpio_to_irq;

/*
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-stmpe.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ static struct gpio_chip template_chip = {
.set = stmpe_gpio_set,
.to_irq = stmpe_gpio_to_irq,
.request = stmpe_gpio_request,
.can_sleep = 1,
.can_sleep = true,
};

static int stmpe_gpio_irq_set_type(struct irq_data *d, unsigned int type)
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-sx150x.c
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ static void sx150x_init_chip(struct sx150x_chip *chip,
chip->gpio_chip.set = sx150x_gpio_set;
chip->gpio_chip.to_irq = sx150x_gpio_to_irq;
chip->gpio_chip.base = pdata->gpio_base;
chip->gpio_chip.can_sleep = 1;
chip->gpio_chip.can_sleep = true;
chip->gpio_chip.ngpio = chip->dev_cfg->ngpios;
if (pdata->oscio_is_gpo)
++chip->gpio_chip.ngpio;
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-tb10x.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ static int tb10x_gpio_probe(struct platform_device *pdev)
tb10x_gpio->gc.free = tb10x_gpio_free;
tb10x_gpio->gc.base = -1;
tb10x_gpio->gc.ngpio = ngpio;
tb10x_gpio->gc.can_sleep = 0;
tb10x_gpio->gc.can_sleep = false;


ret = gpiochip_add(&tb10x_gpio->gc);
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-tc3589x.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ static struct gpio_chip template_chip = {
.direction_output = tc3589x_gpio_direction_output,
.set = tc3589x_gpio_set,
.to_irq = tc3589x_gpio_to_irq,
.can_sleep = 1,
.can_sleep = true,
};

static int tc3589x_gpio_irq_set_type(struct irq_data *d, unsigned int type)
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-timberdale.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ static int timbgpio_probe(struct platform_device *pdev)
gc->dbg_show = NULL;
gc->base = pdata->gpio_base;
gc->ngpio = pdata->nr_pins;
gc->can_sleep = 0;
gc->can_sleep = false;

err = gpiochip_add(gc);
if (err)
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-tnetv107x.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ static int __init tnetv107x_gpio_setup(void)
ctlr = &chips[i];

ctlr->chip.label = "tnetv107x";
ctlr->chip.can_sleep = 0;
ctlr->chip.can_sleep = false;
ctlr->chip.base = base;
ctlr->chip.ngpio = ngpio - base;
if (ctlr->chip.ngpio > 32)
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-tps6586x.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ static int tps6586x_gpio_probe(struct platform_device *pdev)
tps6586x_gpio->gpio_chip.label = pdev->name;
tps6586x_gpio->gpio_chip.dev = &pdev->dev;
tps6586x_gpio->gpio_chip.ngpio = 4;
tps6586x_gpio->gpio_chip.can_sleep = 1;
tps6586x_gpio->gpio_chip.can_sleep = true;

/* FIXME: add handling of GPIOs as dedicated inputs */
tps6586x_gpio->gpio_chip.direction_output = tps6586x_gpio_output;
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-tps65910.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ static int tps65910_gpio_probe(struct platform_device *pdev)
default:
return -EINVAL;
}
tps65910_gpio->gpio_chip.can_sleep = 1;
tps65910_gpio->gpio_chip.can_sleep = true;
tps65910_gpio->gpio_chip.direction_input = tps65910_gpio_input;
tps65910_gpio->gpio_chip.direction_output = tps65910_gpio_output;
tps65910_gpio->gpio_chip.set = tps65910_gpio_set;
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-tps65912.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ static struct gpio_chip template_chip = {
.direction_output = tps65912_gpio_output,
.get = tps65912_gpio_get,
.set = tps65912_gpio_set,
.can_sleep = 1,
.can_sleep = true,
.ngpio = 5,
.base = -1,
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-twl4030.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ static struct gpio_chip template_chip = {
.direction_output = twl_direction_out,
.set = twl_set,
.to_irq = twl_to_irq,
.can_sleep = 1,
.can_sleep = true,
};

/*----------------------------------------------------------------------*/
Expand Down
Loading

0 comments on commit 9fb1f39

Please sign in to comment.