2012-08-29 01:35:35

by Axel Lin

[permalink] [raw]
Subject: [PATCH 1/2] gpio: mc9s08dz60: Fix build error if I2C=m

Make GPIO_MC9S08DZ60 depend on I2C=y, this fixes below build error:

LD init/built-in.o
drivers/built-in.o: In function `mc9s08dz60_get_value':
clk-fixed-factor.c:(.text+0x7214): undefined reference to `i2c_smbus_read_byte_data'
drivers/built-in.o: In function `mc9s08dz60_set':
clk-fixed-factor.c:(.text+0x727c): undefined reference to `i2c_smbus_read_byte_data'
clk-fixed-factor.c:(.text+0x72bc): undefined reference to `i2c_smbus_write_byte_data'
drivers/built-in.o: In function `mc9s08dz60_i2c_driver_init':
clk-fixed-factor.c:(.init.text+0x290): undefined reference to `i2c_register_driver'
drivers/built-in.o: In function `mc9s08dz60_i2c_driver_exit':
clk-fixed-factor.c:(.exit.text+0x2c): undefined reference to `i2c_del_driver'
make: *** [vmlinux] Error 1

Signed-off-by: Axel Lin <[email protected]>
---
drivers/gpio/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index b16c8a7..ba7926f5 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -294,7 +294,7 @@ config GPIO_MAX732X_IRQ

config GPIO_MC9S08DZ60
bool "MX35 3DS BOARD MC9S08DZ60 GPIO functions"
- depends on I2C && MACH_MX35_3DS
+ depends on I2C=y && MACH_MX35_3DS
help
Select this to enable the MC9S08DZ60 GPIO driver

--
1.7.9.5



2012-08-29 01:37:03

by Axel Lin

[permalink] [raw]
Subject: [PATCH 2/2] gpio: mc9s08dz60: Use devm_kzalloc API

Signed-off-by: Axel Lin <[email protected]>
---
drivers/gpio/gpio-mc9s08dz60.c | 21 +++------------------
1 file changed, 3 insertions(+), 18 deletions(-)

diff --git a/drivers/gpio/gpio-mc9s08dz60.c b/drivers/gpio/gpio-mc9s08dz60.c
index 2738cc4..0ab7000 100644
--- a/drivers/gpio/gpio-mc9s08dz60.c
+++ b/drivers/gpio/gpio-mc9s08dz60.c
@@ -91,10 +91,9 @@ static int mc9s08dz60_direction_output(struct gpio_chip *gc,
static int mc9s08dz60_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
- int ret = 0;
struct mc9s08dz60 *mc9s;

- mc9s = kzalloc(sizeof(*mc9s), GFP_KERNEL);
+ mc9s = devm_kzalloc(&client->dev, sizeof(*mc9s), GFP_KERNEL);
if (!mc9s)
return -ENOMEM;

@@ -110,30 +109,16 @@ static int mc9s08dz60_probe(struct i2c_client *client,
mc9s->client = client;
i2c_set_clientdata(client, mc9s);

- ret = gpiochip_add(&mc9s->chip);
- if (ret)
- goto error;
-
- return 0;
-
- error:
- kfree(mc9s);
- return ret;
+ return gpiochip_add(&mc9s->chip);
}

static int mc9s08dz60_remove(struct i2c_client *client)
{
struct mc9s08dz60 *mc9s;
- int ret;

mc9s = i2c_get_clientdata(client);

- ret = gpiochip_remove(&mc9s->chip);
- if (!ret)
- kfree(mc9s);
-
- return ret;
-
+ return gpiochip_remove(&mc9s->chip);
}

static const struct i2c_device_id mc9s08dz60_id[] = {
--
1.7.9.5


2012-08-31 23:01:31

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH 1/2] gpio: mc9s08dz60: Fix build error if I2C=m

On Wed, Aug 29, 2012 at 3:35 AM, Axel Lin <[email protected]> wrote:

> Make GPIO_MC9S08DZ60 depend on I2C=y, this fixes below build error:
>
> LD init/built-in.o
> drivers/built-in.o: In function `mc9s08dz60_get_value':
> clk-fixed-factor.c:(.text+0x7214): undefined reference to `i2c_smbus_read_byte_data'
> drivers/built-in.o: In function `mc9s08dz60_set':
> clk-fixed-factor.c:(.text+0x727c): undefined reference to `i2c_smbus_read_byte_data'
> clk-fixed-factor.c:(.text+0x72bc): undefined reference to `i2c_smbus_write_byte_data'
> drivers/built-in.o: In function `mc9s08dz60_i2c_driver_init':
> clk-fixed-factor.c:(.init.text+0x290): undefined reference to `i2c_register_driver'
> drivers/built-in.o: In function `mc9s08dz60_i2c_driver_exit':
> clk-fixed-factor.c:(.exit.text+0x2c): undefined reference to `i2c_del_driver'
> make: *** [vmlinux] Error 1
>
> Signed-off-by: Axel Lin <[email protected]>

Patch applied.

Freescale folks: yell if you disagree.

Thanks!
Linus Walleij

2012-08-31 23:05:08

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH 2/2] gpio: mc9s08dz60: Use devm_kzalloc API

On Wed, Aug 29, 2012 at 3:36 AM, Axel Lin <[email protected]> wrote:

> Signed-off-by: Axel Lin <[email protected]>
> ---
> drivers/gpio/gpio-mc9s08dz60.c | 21 +++------------------
> 1 file changed, 3 insertions(+), 18 deletions(-)

Patch applied to devel.

Freescale folks, if you prefer to take this into your tree tell me
and I'll take it out.

If you want to explicitly ACK all new Freescale patches,
consider updating MAINTAINERS for this driver.

Yours,
Linus Walleij