Skip to contentSkip to conversation

gpio: mc9s08dz60: Fix build error if I2C=m

PATCH In review Axel Lin 2 participants 4 messages Aug 29, 2012 – Aug 31, 2012 GPIO

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

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

---
 drivers/gpio/Kconfig |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/Kconfig +1 -1
index b16c8a7..ba7926f5 100644
@@ -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
 
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH 2/2 gpio: mc9s08dz60: Use devm_kzalloc API

---
 drivers/gpio/gpio-mc9s08dz60.c |   21 +++------------------
 1 file changed, 3 insertions(+), 18 deletions(-)
drivers/gpio/gpio-mc9s08dz60.c +3 -18
index 2738cc4..0ab7000 100644
@@ -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[] = {
Signature · 1 line
1.7.9.5
#2 lore raw

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

Quoted 4 lines · Axel Lin
---
 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

#3 lore raw
In reply to Axel Lin
Quoted 14 lines · Axel Lin

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

Quoted 1 line

Patch applied.

Freescale folks: yell if you disagree.

Thanks!
Linus Walleij