aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Lu <aaron.lu@intel.com>2013-11-19 02:21:24 -0500
committerZhang Rui <rui.zhang@intel.com>2014-10-10 01:57:11 -0400
commit8dd41f78adebb57909cccb0272e74c79e38b5238 (patch)
tree2689c5c2eaabc7ef048bb392e7b0246b3276603f
parentbd6ad24342c3bc0476ba3f0b647c5ba0a71b45b4 (diff)
ACPI / fan: remove no need check for device pointer
The device pointer will not be NULL in the PM callback and ACPI driver's add/remove callback, so checking NULL for them isn't necessary. Signed-off-by: Aaron Lu <aaron.lu@intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
-rw-r--r--drivers/acpi/fan.c18
1 files changed, 1 insertions, 17 deletions
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c
index 562d5f3a1bb5..df861bbc73cc 100644
--- a/drivers/acpi/fan.c
+++ b/drivers/acpi/fan.c
@@ -131,9 +131,6 @@ static int acpi_fan_add(struct acpi_device *device)
131 int result = 0; 131 int result = 0;
132 struct thermal_cooling_device *cdev; 132 struct thermal_cooling_device *cdev;
133 133
134 if (!device)
135 return -EINVAL;
136
137 strcpy(acpi_device_name(device), "Fan"); 134 strcpy(acpi_device_name(device), "Fan");
138 strcpy(acpi_device_class(device), ACPI_FAN_CLASS); 135 strcpy(acpi_device_class(device), ACPI_FAN_CLASS);
139 136
@@ -177,14 +174,7 @@ end:
177 174
178static int acpi_fan_remove(struct acpi_device *device) 175static int acpi_fan_remove(struct acpi_device *device)
179{ 176{
180 struct thermal_cooling_device *cdev; 177 struct thermal_cooling_device *cdev = acpi_driver_data(device);
181
182 if (!device)
183 return -EINVAL;
184
185 cdev = acpi_driver_data(device);
186 if (!cdev)
187 return -EINVAL;
188 178
189 sysfs_remove_link(&device->dev.kobj, "thermal_cooling"); 179 sysfs_remove_link(&device->dev.kobj, "thermal_cooling");
190 sysfs_remove_link(&cdev->device.kobj, "device"); 180 sysfs_remove_link(&cdev->device.kobj, "device");
@@ -196,9 +186,6 @@ static int acpi_fan_remove(struct acpi_device *device)
196#ifdef CONFIG_PM_SLEEP 186#ifdef CONFIG_PM_SLEEP
197static int acpi_fan_suspend(struct device *dev) 187static int acpi_fan_suspend(struct device *dev)
198{ 188{
199 if (!dev)
200 return -EINVAL;
201
202 acpi_bus_set_power(to_acpi_device(dev)->handle, ACPI_STATE_D0); 189 acpi_bus_set_power(to_acpi_device(dev)->handle, ACPI_STATE_D0);
203 190
204 return AE_OK; 191 return AE_OK;
@@ -208,9 +195,6 @@ static int acpi_fan_resume(struct device *dev)
208{ 195{
209 int result; 196 int result;
210 197
211 if (!dev)
212 return -EINVAL;
213
214 result = acpi_bus_update_power(to_acpi_device(dev)->handle, NULL); 198 result = acpi_bus_update_power(to_acpi_device(dev)->handle, NULL);
215 if (result) 199 if (result)
216 printk(KERN_ERR PREFIX "Error updating fan power state\n"); 200 printk(KERN_ERR PREFIX "Error updating fan power state\n");