Skip to contentSkip to conversation

mfd: max8998 cleanups

PATCH In review Axel Lin 2 participants 3 messages Oct 20, 2010 – Oct 22, 2010 Multifunction devices (MFD)

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 mfd: max8998 cleanups

This patch includes below fixes:
1. i2c_smbus_write_byte_data() returns zero or negative value, therefore no need to check if ret is greater than zero or not.
2. Properly free irq and unregister max8998->rtc device in max8998_i2c_probe() error path and max8998_i2c_remove().

---
 drivers/mfd/max8998.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/mfd/max8998.c +4 -2
index a720f41..bb9977b 100644
@@ -110,8 +110,6 @@ int max8998_update_reg(struct i2c_client *i2c, u8 reg, u8 val, u8 mask)
 		u8 old_val = ret & 0xff;
 		u8 new_val = (val & mask) | (old_val & (~mask));
 		ret = i2c_smbus_write_byte_data(i2c, reg, new_val);
-		if (ret >= 0)
-			ret = 0;
 	}
 	mutex_unlock(&max8998->iolock);
 	return ret;
@@ -155,6 +153,8 @@ static int max8998_i2c_probe(struct i2c_client *i2c,
 
 err:
 	mfd_remove_devices(max8998->dev);
+	max8998_irq_exit(max8998);
+	i2c_unregister_device(max8998->rtc);
 	kfree(max8998);
 	return ret;
 }
@@ -164,6 +164,8 @@ static int max8998_i2c_remove(struct i2c_client *i2c)
 	struct max8998_dev *max8998 = i2c_get_clientdata(i2c);
 
 	mfd_remove_devices(max8998->dev);
+	max8998_irq_exit(max8998);
+	i2c_unregister_device(max8998->rtc);
 	kfree(max8998);
 
 	return 0;
Signature · 1 line
1.7.2
#1 lore raw

Hi Axel,

Quoted 5 lines · Axel Lin

This patch includes below fixes:
1. i2c_smbus_write_byte_data() returns zero or negative value, therefore no need to check if ret is greater than zero or not.
2. Properly free irq and unregister max8998->rtc device in max8998_i2c_probe() error path and max8998_i2c_remove().

The fixes make sense, I'd appreciate to get 2 separate patches for them though.

Cheers,
Samuel.

Quoted 41 lines
---
 drivers/mfd/max8998.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/mfd/max8998.c +4 -2
index a720f41..bb9977b 100644
@@ -110,8 +110,6 @@ int max8998_update_reg(struct i2c_client *i2c, u8 reg, u8 val, u8 mask)
 		u8 old_val = ret & 0xff;
 		u8 new_val = (val & mask) | (old_val & (~mask));
 		ret = i2c_smbus_write_byte_data(i2c, reg, new_val);
-		if (ret >= 0)
-			ret = 0;
 	}
 	mutex_unlock(&max8998->iolock);
 	return ret;
@@ -155,6 +153,8 @@ static int max8998_i2c_probe(struct i2c_client *i2c,
 
 err:
 	mfd_remove_devices(max8998->dev);
+	max8998_irq_exit(max8998);
+	i2c_unregister_device(max8998->rtc);
 	kfree(max8998);
 	return ret;
 }
@@ -164,6 +164,8 @@ static int max8998_i2c_remove(struct i2c_client *i2c)
 	struct max8998_dev *max8998 = i2c_get_clientdata(i2c);
 
 	mfd_remove_devices(max8998->dev);
+	max8998_irq_exit(max8998);
+	i2c_unregister_device(max8998->rtc);
 	kfree(max8998);
 
 	return 0;
Signature · 1 line
1.7.2
Signature · 2 lines
Intel Open Source Technology Centre
http://oss.intel.com/
author
#2 lore raw

2010/10/22 Samuel Ortiz <[email protected]>:

Quoted 11 lines

Hi Axel,

Quoted 5 lines · Axel Lin

This patch includes below fixes:
1. i2c_smbus_write_byte_data() returns zero or negative value, therefore no need to check if ret is greater than zero or not.
2. Properly free irq and unregister max8998->rtc device in max8998_i2c_probe() error path and max8998_i2c_remove().

The fixes make sense, I'd appreciate to get 2 separate patches for them though.

Ok. I will resend with 2 separate patches.

Regards,
Axel

Quoted 50 lines

Cheers,
Samuel.

Quoted 37 lines

---
 drivers/mfd/max8998.c |    6 ++++--

 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/mfd/max8998.c +0 -2
index a720f41..bb9977b 100644
@@ -110,8 +110,6 @@ int max8998_update_reg(struct i2c_client *i2c, u8 reg, u8 val, u8 mask)
               u8 old_val = ret & 0xff;
               u8 new_val = (val & mask) | (old_val & (~mask));
               ret = i2c_smbus_write_byte_data(i2c, reg, new_val);
-             if (ret >= 0)
-                     ret = 0;
       }
       mutex_unlock(&max8998->iolock);
       return ret;
@@ -155,6 +153,8 @@ static int max8998_i2c_probe(struct i2c_client *i2c,
 

 err:
      mfd_remove_devices(max8998->dev);
+     max8998_irq_exit(max8998);
+     i2c_unregister_device(max8998->rtc);
      kfree(max8998);
      return ret;
 }

drivers/mfd/max8998.c +2 -1
@@ -164,6 +164,8 @@ static int max8998_i2c_remove(struct i2c_client *i2c)
       struct max8998_dev *max8998 = i2c_get_clientdata(i2c);
 
       mfd_remove_devices(max8998->dev);
+     max8998_irq_exit(max8998);
+     i2c_unregister_device(max8998->rtc);
       kfree(max8998);
 
       return 0;
--
Quoted 4 lines

1.7.2

--
Intel Open Source Technology Centre
http://oss.intel.com/