mirror of
https://github.com/torvalds/linux.git
synced 2024-12-28 22:02:28 +00:00
gpio: use dev_get_platdata()
Use the wrapper function for retrieving the platform data instead of accessing dev->platform_data directly. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
c0e811d9f5
commit
e56aee1897
@ -129,7 +129,7 @@ static int gen_74x164_probe(struct spi_device *spi)
|
||||
if (!chip)
|
||||
return -ENOMEM;
|
||||
|
||||
pdata = spi->dev.platform_data;
|
||||
pdata = dev_get_platdata(&spi->dev);
|
||||
if (pdata && pdata->base)
|
||||
chip->gpio_chip.base = pdata->base;
|
||||
else
|
||||
|
@ -89,7 +89,7 @@ static int adp5520_gpio_direction_output(struct gpio_chip *chip,
|
||||
|
||||
static int adp5520_gpio_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct adp5520_gpio_platform_data *pdata = pdev->dev.platform_data;
|
||||
struct adp5520_gpio_platform_data *pdata = dev_get_platdata(&pdev->dev);
|
||||
struct adp5520_gpio *dev;
|
||||
struct gpio_chip *gc;
|
||||
int ret, i, gpios;
|
||||
|
@ -276,7 +276,8 @@ static irqreturn_t adp5588_irq_handler(int irq, void *devid)
|
||||
static int adp5588_irq_setup(struct adp5588_gpio *dev)
|
||||
{
|
||||
struct i2c_client *client = dev->client;
|
||||
struct adp5588_gpio_platform_data *pdata = client->dev.platform_data;
|
||||
struct adp5588_gpio_platform_data *pdata =
|
||||
dev_get_platdata(&client->dev);
|
||||
unsigned gpio;
|
||||
int ret;
|
||||
|
||||
@ -349,7 +350,8 @@ static void adp5588_irq_teardown(struct adp5588_gpio *dev)
|
||||
static int adp5588_gpio_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
{
|
||||
struct adp5588_gpio_platform_data *pdata = client->dev.platform_data;
|
||||
struct adp5588_gpio_platform_data *pdata =
|
||||
dev_get_platdata(&client->dev);
|
||||
struct adp5588_gpio *dev;
|
||||
struct gpio_chip *gc;
|
||||
int ret, i, revid;
|
||||
@ -440,7 +442,8 @@ err:
|
||||
|
||||
static int adp5588_gpio_remove(struct i2c_client *client)
|
||||
{
|
||||
struct adp5588_gpio_platform_data *pdata = client->dev.platform_data;
|
||||
struct adp5588_gpio_platform_data *pdata =
|
||||
dev_get_platdata(&client->dev);
|
||||
struct adp5588_gpio *dev = i2c_get_clientdata(client);
|
||||
int ret;
|
||||
|
||||
|
@ -97,7 +97,7 @@ static struct gpio_chip template_chip = {
|
||||
static int arizona_gpio_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct arizona *arizona = dev_get_drvdata(pdev->dev.parent);
|
||||
struct arizona_pdata *pdata = arizona->dev->platform_data;
|
||||
struct arizona_pdata *pdata = dev_get_platdata(arizona->dev);
|
||||
struct arizona_gpio *arizona_gpio;
|
||||
int ret;
|
||||
|
||||
|
@ -216,7 +216,7 @@ static int da9052_gpio_probe(struct platform_device *pdev)
|
||||
return -ENOMEM;
|
||||
|
||||
gpio->da9052 = dev_get_drvdata(pdev->dev.parent);
|
||||
pdata = gpio->da9052->dev->platform_data;
|
||||
pdata = dev_get_platdata(gpio->da9052->dev);
|
||||
|
||||
gpio->gp = reference_gp;
|
||||
if (pdata && pdata->gpio_base)
|
||||
|
@ -150,7 +150,7 @@ static int da9055_gpio_probe(struct platform_device *pdev)
|
||||
return -ENOMEM;
|
||||
|
||||
gpio->da9055 = dev_get_drvdata(pdev->dev.parent);
|
||||
pdata = gpio->da9055->dev->platform_data;
|
||||
pdata = dev_get_platdata(gpio->da9055->dev);
|
||||
|
||||
gpio->gp = reference_gp;
|
||||
if (pdata && pdata->gpio_base)
|
||||
|
@ -253,7 +253,7 @@ static struct irq_domain_ops em_gio_irq_domain_ops = {
|
||||
static int em_gio_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct gpio_em_config pdata_dt;
|
||||
struct gpio_em_config *pdata = pdev->dev.platform_data;
|
||||
struct gpio_em_config *pdata = dev_get_platdata(&pdev->dev);
|
||||
struct em_gio_priv *p;
|
||||
struct resource *io[2], *irq[2];
|
||||
struct gpio_chip *gpio_chip;
|
||||
|
@ -354,7 +354,7 @@ static int ichx_gpio_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct resource *res_base, *res_pm;
|
||||
int err;
|
||||
struct lpc_ich_info *ich_info = pdev->dev.platform_data;
|
||||
struct lpc_ich_info *ich_info = dev_get_platdata(&pdev->dev);
|
||||
|
||||
if (!ich_info)
|
||||
return -ENODEV;
|
||||
|
@ -149,7 +149,7 @@ static int ttl_probe(struct platform_device *pdev)
|
||||
struct resource *res;
|
||||
int ret;
|
||||
|
||||
pdata = pdev->dev.platform_data;
|
||||
pdata = dev_get_platdata(&pdev->dev);
|
||||
if (!pdata) {
|
||||
dev_err(dev, "no platform data\n");
|
||||
ret = -ENXIO;
|
||||
|
@ -150,7 +150,7 @@ static int kempld_gpio_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct kempld_device_data *pld = dev_get_drvdata(dev->parent);
|
||||
struct kempld_platform_data *pdata = pld->dev->platform_data;
|
||||
struct kempld_platform_data *pdata = dev_get_platdata(pld->dev);
|
||||
struct kempld_gpio_data *gpio;
|
||||
struct gpio_chip *chip;
|
||||
int ret;
|
||||
|
@ -166,7 +166,7 @@ int __max730x_probe(struct max7301 *ts)
|
||||
struct max7301_platform_data *pdata;
|
||||
int i, ret;
|
||||
|
||||
pdata = dev->platform_data;
|
||||
pdata = dev_get_platdata(dev);
|
||||
|
||||
mutex_init(&ts->lock);
|
||||
dev_set_drvdata(dev, ts);
|
||||
|
@ -453,7 +453,7 @@ static int max732x_irq_setup(struct max732x_chip *chip,
|
||||
const struct i2c_device_id *id)
|
||||
{
|
||||
struct i2c_client *client = chip->client;
|
||||
struct max732x_platform_data *pdata = client->dev.platform_data;
|
||||
struct max732x_platform_data *pdata = dev_get_platdata(&client->dev);
|
||||
int has_irq = max732x_features[id->driver_data] >> 32;
|
||||
int ret;
|
||||
|
||||
@ -512,7 +512,7 @@ static int max732x_irq_setup(struct max732x_chip *chip,
|
||||
const struct i2c_device_id *id)
|
||||
{
|
||||
struct i2c_client *client = chip->client;
|
||||
struct max732x_platform_data *pdata = client->dev.platform_data;
|
||||
struct max732x_platform_data *pdata = dev_get_platdata(&client->dev);
|
||||
int has_irq = max732x_features[id->driver_data] >> 32;
|
||||
|
||||
if (pdata->irq_base && has_irq != INT_NONE)
|
||||
@ -583,7 +583,7 @@ static int max732x_probe(struct i2c_client *client,
|
||||
uint16_t addr_a, addr_b;
|
||||
int ret, nr_port;
|
||||
|
||||
pdata = client->dev.platform_data;
|
||||
pdata = dev_get_platdata(&client->dev);
|
||||
if (pdata == NULL) {
|
||||
dev_dbg(&client->dev, "no platform data\n");
|
||||
return -EINVAL;
|
||||
@ -653,7 +653,7 @@ out_failed:
|
||||
|
||||
static int max732x_remove(struct i2c_client *client)
|
||||
{
|
||||
struct max732x_platform_data *pdata = client->dev.platform_data;
|
||||
struct max732x_platform_data *pdata = dev_get_platdata(&client->dev);
|
||||
struct max732x_chip *chip = i2c_get_clientdata(client);
|
||||
int ret;
|
||||
|
||||
|
@ -86,7 +86,7 @@ static int mc33880_probe(struct spi_device *spi)
|
||||
struct mc33880_platform_data *pdata;
|
||||
int ret;
|
||||
|
||||
pdata = spi->dev.platform_data;
|
||||
pdata = dev_get_platdata(&spi->dev);
|
||||
if (!pdata || !pdata->base) {
|
||||
dev_dbg(&spi->dev, "incorrect or missing platform data\n");
|
||||
return -EINVAL;
|
||||
|
@ -520,7 +520,7 @@ static int mcp230xx_probe(struct i2c_client *client,
|
||||
|
||||
match = of_match_device(of_match_ptr(mcp23s08_i2c_of_match),
|
||||
&client->dev);
|
||||
pdata = client->dev.platform_data;
|
||||
pdata = dev_get_platdata(&client->dev);
|
||||
if (match || !pdata) {
|
||||
base = -1;
|
||||
pullups = 0;
|
||||
@ -634,7 +634,7 @@ static int mcp23s08_probe(struct spi_device *spi)
|
||||
pullups[addr] = 0;
|
||||
} else {
|
||||
type = spi_get_device_id(spi)->driver_data;
|
||||
pdata = spi->dev.platform_data;
|
||||
pdata = dev_get_platdata(&spi->dev);
|
||||
if (!pdata || !gpio_is_valid(pdata->base)) {
|
||||
dev_dbg(&spi->dev,
|
||||
"invalid or missing platform data\n");
|
||||
|
@ -259,7 +259,7 @@ static void msic_gpio_irq_handler(unsigned irq, struct irq_desc *desc)
|
||||
static int platform_msic_gpio_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct intel_msic_gpio_pdata *pdata = dev->platform_data;
|
||||
struct intel_msic_gpio_pdata *pdata = dev_get_platdata(dev);
|
||||
struct msic_gpio *mg;
|
||||
int irq = platform_get_irq(pdev, 0);
|
||||
int retval;
|
||||
|
@ -1100,7 +1100,7 @@ static int omap_gpio_probe(struct platform_device *pdev)
|
||||
|
||||
match = of_match_device(of_match_ptr(omap_gpio_match), dev);
|
||||
|
||||
pdata = match ? match->data : dev->platform_data;
|
||||
pdata = match ? match->data : dev_get_platdata(dev);
|
||||
if (!pdata)
|
||||
return -EINVAL;
|
||||
|
||||
|
@ -731,7 +731,7 @@ static int pca953x_probe(struct i2c_client *client,
|
||||
if (chip == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
pdata = client->dev.platform_data;
|
||||
pdata = dev_get_platdata(&client->dev);
|
||||
if (pdata) {
|
||||
irq_base = pdata->irq_base;
|
||||
chip->gpio_start = pdata->gpio_base;
|
||||
@ -785,7 +785,7 @@ static int pca953x_probe(struct i2c_client *client,
|
||||
|
||||
static int pca953x_remove(struct i2c_client *client)
|
||||
{
|
||||
struct pca953x_platform_data *pdata = client->dev.platform_data;
|
||||
struct pca953x_platform_data *pdata = dev_get_platdata(&client->dev);
|
||||
struct pca953x_chip *chip = i2c_get_clientdata(client);
|
||||
int ret = 0;
|
||||
|
||||
|
@ -262,7 +262,7 @@ static int pcf857x_probe(struct i2c_client *client,
|
||||
struct pcf857x *gpio;
|
||||
int status;
|
||||
|
||||
pdata = client->dev.platform_data;
|
||||
pdata = dev_get_platdata(&client->dev);
|
||||
if (!pdata) {
|
||||
dev_dbg(&client->dev, "no platform data\n");
|
||||
}
|
||||
@ -396,7 +396,7 @@ fail:
|
||||
|
||||
static int pcf857x_remove(struct i2c_client *client)
|
||||
{
|
||||
struct pcf857x_platform_data *pdata = client->dev.platform_data;
|
||||
struct pcf857x_platform_data *pdata = dev_get_platdata(&client->dev);
|
||||
struct pcf857x *gpio = i2c_get_clientdata(client);
|
||||
int status = 0;
|
||||
|
||||
|
@ -259,7 +259,7 @@ static const struct irq_domain_ops pl061_domain_ops = {
|
||||
static int pl061_probe(struct amba_device *adev, const struct amba_id *id)
|
||||
{
|
||||
struct device *dev = &adev->dev;
|
||||
struct pl061_platform_data *pdata = dev->platform_data;
|
||||
struct pl061_platform_data *pdata = dev_get_platdata(dev);
|
||||
struct pl061_gpio *chip;
|
||||
int ret, irq, i, irq_base;
|
||||
|
||||
|
@ -285,7 +285,7 @@ static struct irq_domain_ops gpio_rcar_irq_domain_ops = {
|
||||
|
||||
static void gpio_rcar_parse_pdata(struct gpio_rcar_priv *p)
|
||||
{
|
||||
struct gpio_rcar_config *pdata = p->pdev->dev.platform_data;
|
||||
struct gpio_rcar_config *pdata = dev_get_platdata(&p->pdev->dev);
|
||||
struct device_node *np = p->pdev->dev.of_node;
|
||||
struct of_phandle_args args;
|
||||
int ret;
|
||||
|
@ -135,7 +135,7 @@ static int rdc321x_gpio_probe(struct platform_device *pdev)
|
||||
struct rdc321x_gpio *rdc321x_gpio_dev;
|
||||
struct rdc321x_gpio_pdata *pdata;
|
||||
|
||||
pdata = pdev->dev.platform_data;
|
||||
pdata = dev_get_platdata(&pdev->dev);
|
||||
if (!pdata) {
|
||||
dev_err(&pdev->dev, "no platform data supplied\n");
|
||||
return -ENODEV;
|
||||
|
@ -361,7 +361,7 @@ static int gsta_probe(struct platform_device *dev)
|
||||
struct gsta_gpio *chip;
|
||||
struct resource *res;
|
||||
|
||||
pdev = *(struct pci_dev **)(dev->dev.platform_data);
|
||||
pdev = *(struct pci_dev **)dev_get_platdata(&dev->dev);
|
||||
gpio_pdata = dev_get_platdata(&pdev->dev);
|
||||
|
||||
if (gpio_pdata == NULL)
|
||||
|
@ -583,7 +583,7 @@ static int sx150x_probe(struct i2c_client *client,
|
||||
struct sx150x_chip *chip;
|
||||
int rc;
|
||||
|
||||
pdata = client->dev.platform_data;
|
||||
pdata = dev_get_platdata(&client->dev);
|
||||
if (!pdata)
|
||||
return -EINVAL;
|
||||
|
||||
|
@ -227,7 +227,7 @@ static int timbgpio_probe(struct platform_device *pdev)
|
||||
struct gpio_chip *gc;
|
||||
struct timbgpio *tgpio;
|
||||
struct resource *iomem;
|
||||
struct timbgpio_platform_data *pdata = pdev->dev.platform_data;
|
||||
struct timbgpio_platform_data *pdata = dev_get_platdata(&pdev->dev);
|
||||
int irq = platform_get_irq(pdev, 0);
|
||||
|
||||
if (!pdata || pdata->nr_pins > 32) {
|
||||
@ -318,7 +318,7 @@ err_mem:
|
||||
static int timbgpio_remove(struct platform_device *pdev)
|
||||
{
|
||||
int err;
|
||||
struct timbgpio_platform_data *pdata = pdev->dev.platform_data;
|
||||
struct timbgpio_platform_data *pdata = dev_get_platdata(&pdev->dev);
|
||||
struct timbgpio *tgpio = platform_get_drvdata(pdev);
|
||||
struct resource *iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
int irq = platform_get_irq(pdev, 0);
|
||||
|
@ -87,7 +87,7 @@ static struct gpio_chip template_chip = {
|
||||
static int tps65912_gpio_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct tps65912 *tps65912 = dev_get_drvdata(pdev->dev.parent);
|
||||
struct tps65912_board *pdata = tps65912->dev->platform_data;
|
||||
struct tps65912_board *pdata = dev_get_platdata(tps65912->dev);
|
||||
struct tps65912_gpio_data *tps65912_gpio;
|
||||
int ret;
|
||||
|
||||
|
@ -322,7 +322,7 @@ static void ts5500_disable_irq(struct ts5500_priv *priv)
|
||||
static int ts5500_dio_probe(struct platform_device *pdev)
|
||||
{
|
||||
enum ts5500_blocks block = platform_get_device_id(pdev)->driver_data;
|
||||
struct ts5500_dio_platform_data *pdata = pdev->dev.platform_data;
|
||||
struct ts5500_dio_platform_data *pdata = dev_get_platdata(&pdev->dev);
|
||||
struct device *dev = &pdev->dev;
|
||||
const char *name = dev_name(dev);
|
||||
struct ts5500_priv *priv;
|
||||
|
@ -256,7 +256,7 @@ static int twl_request(struct gpio_chip *chip, unsigned offset)
|
||||
/* optionally have the first two GPIOs switch vMMC1
|
||||
* and vMMC2 power supplies based on card presence.
|
||||
*/
|
||||
pdata = chip->dev->platform_data;
|
||||
pdata = dev_get_platdata(chip->dev);
|
||||
if (pdata)
|
||||
value |= pdata->mmc_cd & 0x03;
|
||||
|
||||
@ -460,7 +460,7 @@ static struct twl4030_gpio_platform_data *of_gpio_twl4030(struct device *dev)
|
||||
|
||||
static int gpio_twl4030_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct twl4030_gpio_platform_data *pdata = pdev->dev.platform_data;
|
||||
struct twl4030_gpio_platform_data *pdata = dev_get_platdata(&pdev->dev);
|
||||
struct device_node *node = pdev->dev.of_node;
|
||||
struct gpio_twl4030_priv *priv;
|
||||
int ret, irq_base;
|
||||
@ -556,7 +556,7 @@ out:
|
||||
/* Cannot use as gpio_twl4030_probe() calls us */
|
||||
static int gpio_twl4030_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct twl4030_gpio_platform_data *pdata = pdev->dev.platform_data;
|
||||
struct twl4030_gpio_platform_data *pdata = dev_get_platdata(&pdev->dev);
|
||||
struct gpio_twl4030_priv *priv = platform_get_drvdata(pdev);
|
||||
int status;
|
||||
|
||||
|
@ -45,7 +45,7 @@ static void ucb1400_gpio_set(struct gpio_chip *gc, unsigned off, int val)
|
||||
|
||||
static int ucb1400_gpio_probe(struct platform_device *dev)
|
||||
{
|
||||
struct ucb1400_gpio *ucb = dev->dev.platform_data;
|
||||
struct ucb1400_gpio *ucb = dev_get_platdata(&dev->dev);
|
||||
int err = 0;
|
||||
|
||||
if (!(ucb && ucb->gpio_offset)) {
|
||||
|
@ -246,7 +246,7 @@ static struct gpio_chip template_chip = {
|
||||
static int wm831x_gpio_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent);
|
||||
struct wm831x_pdata *pdata = wm831x->dev->platform_data;
|
||||
struct wm831x_pdata *pdata = dev_get_platdata(wm831x->dev);
|
||||
struct wm831x_gpio *wm831x_gpio;
|
||||
int ret;
|
||||
|
||||
|
@ -112,7 +112,7 @@ static struct gpio_chip template_chip = {
|
||||
static int wm8350_gpio_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct wm8350 *wm8350 = dev_get_drvdata(pdev->dev.parent);
|
||||
struct wm8350_platform_data *pdata = wm8350->dev->platform_data;
|
||||
struct wm8350_platform_data *pdata = dev_get_platdata(wm8350->dev);
|
||||
struct wm8350_gpio_data *wm8350_gpio;
|
||||
int ret;
|
||||
|
||||
|
@ -248,7 +248,7 @@ static struct gpio_chip template_chip = {
|
||||
static int wm8994_gpio_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct wm8994 *wm8994 = dev_get_drvdata(pdev->dev.parent);
|
||||
struct wm8994_pdata *pdata = wm8994->dev->platform_data;
|
||||
struct wm8994_pdata *pdata = dev_get_platdata(wm8994->dev);
|
||||
struct wm8994_gpio *wm8994_gpio;
|
||||
int ret;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user