Loading drivers/acpi/fan.c +28 −34 Original line number Diff line number Diff line Loading @@ -30,17 +30,14 @@ #include <asm/uaccess.h> #include <linux/thermal.h> #include <linux/acpi.h> #define PREFIX "ACPI: " #define ACPI_FAN_CLASS "fan" #include <linux/platform_device.h> MODULE_AUTHOR("Paul Diefenbaugh"); MODULE_DESCRIPTION("ACPI Fan Driver"); MODULE_LICENSE("GPL"); static int acpi_fan_add(struct acpi_device *device); static int acpi_fan_remove(struct acpi_device *device); static int acpi_fan_probe(struct platform_device *pdev); static int acpi_fan_remove(struct platform_device *pdev); static const struct acpi_device_id fan_device_ids[] = { {"PNP0C0B", 0}, Loading @@ -62,15 +59,14 @@ static struct dev_pm_ops acpi_fan_pm = { #define FAN_PM_OPS_PTR NULL #endif static struct acpi_driver acpi_fan_driver = { .name = "fan", .class = ACPI_FAN_CLASS, .ids = fan_device_ids, .ops = { .add = acpi_fan_add, static struct platform_driver acpi_fan_driver = { .probe = acpi_fan_probe, .remove = acpi_fan_remove, .driver = { .name = "acpi-fan", .acpi_match_table = fan_device_ids, .pm = FAN_PM_OPS_PTR, }, .drv.pm = FAN_PM_OPS_PTR, }; /* thermal cooling device callbacks */ Loading Loading @@ -126,17 +122,15 @@ static const struct thermal_cooling_device_ops fan_cooling_ops = { Driver Interface -------------------------------------------------------------------------- */ static int acpi_fan_add(struct acpi_device *device) static int acpi_fan_probe(struct platform_device *pdev) { int result = 0; struct thermal_cooling_device *cdev; strcpy(acpi_device_name(device), "Fan"); strcpy(acpi_device_class(device), ACPI_FAN_CLASS); struct acpi_device *device = ACPI_COMPANION(&pdev->dev); result = acpi_device_update_power(device, NULL); if (result) { printk(KERN_ERR PREFIX "Setting initial power state\n"); dev_err(&pdev->dev, "Setting initial power state\n"); goto end; } Loading @@ -147,24 +141,24 @@ static int acpi_fan_add(struct acpi_device *device) goto end; } dev_dbg(&device->dev, "registered as cooling_device%d\n", cdev->id); dev_dbg(&pdev->dev, "registered as cooling_device%d\n", cdev->id); device->driver_data = cdev; result = sysfs_create_link(&device->dev.kobj, platform_set_drvdata(pdev, cdev); result = sysfs_create_link(&pdev->dev.kobj, &cdev->device.kobj, "thermal_cooling"); if (result) dev_err(&device->dev, "Failed to create sysfs link " dev_err(&pdev->dev, "Failed to create sysfs link " "'thermal_cooling'\n"); result = sysfs_create_link(&cdev->device.kobj, &device->dev.kobj, &pdev->dev.kobj, "device"); if (result) dev_err(&device->dev, "Failed to create sysfs link " dev_err(&pdev->dev, "Failed to create sysfs link " "'device'\n"); printk(KERN_INFO PREFIX "%s [%s] (%s)\n", dev_info(&pdev->dev, "%s [%s] (%s)\n", acpi_device_name(device), acpi_device_bid(device), !device->power.state ? "on" : "off"); Loading @@ -172,11 +166,11 @@ static int acpi_fan_add(struct acpi_device *device) return result; } static int acpi_fan_remove(struct acpi_device *device) static int acpi_fan_remove(struct platform_device *pdev) { struct thermal_cooling_device *cdev = acpi_driver_data(device); struct thermal_cooling_device *cdev = platform_get_drvdata(pdev); sysfs_remove_link(&device->dev.kobj, "thermal_cooling"); sysfs_remove_link(&pdev->dev.kobj, "thermal_cooling"); sysfs_remove_link(&cdev->device.kobj, "device"); thermal_cooling_device_unregister(cdev); Loading @@ -186,7 +180,7 @@ static int acpi_fan_remove(struct acpi_device *device) #ifdef CONFIG_PM_SLEEP static int acpi_fan_suspend(struct device *dev) { acpi_device_set_power(to_acpi_device(dev), ACPI_STATE_D0); acpi_device_set_power(ACPI_COMPANION(dev), ACPI_STATE_D0); return AE_OK; } Loading @@ -195,12 +189,12 @@ static int acpi_fan_resume(struct device *dev) { int result; result = acpi_device_update_power(to_acpi_device(dev), NULL); result = acpi_device_update_power(ACPI_COMPANION(dev), NULL); if (result) printk(KERN_ERR PREFIX "Error updating fan power state\n"); dev_err(dev, "Error updating fan power state\n"); return result; } #endif module_acpi_driver(acpi_fan_driver); module_platform_driver(acpi_fan_driver); Loading
drivers/acpi/fan.c +28 −34 Original line number Diff line number Diff line Loading @@ -30,17 +30,14 @@ #include <asm/uaccess.h> #include <linux/thermal.h> #include <linux/acpi.h> #define PREFIX "ACPI: " #define ACPI_FAN_CLASS "fan" #include <linux/platform_device.h> MODULE_AUTHOR("Paul Diefenbaugh"); MODULE_DESCRIPTION("ACPI Fan Driver"); MODULE_LICENSE("GPL"); static int acpi_fan_add(struct acpi_device *device); static int acpi_fan_remove(struct acpi_device *device); static int acpi_fan_probe(struct platform_device *pdev); static int acpi_fan_remove(struct platform_device *pdev); static const struct acpi_device_id fan_device_ids[] = { {"PNP0C0B", 0}, Loading @@ -62,15 +59,14 @@ static struct dev_pm_ops acpi_fan_pm = { #define FAN_PM_OPS_PTR NULL #endif static struct acpi_driver acpi_fan_driver = { .name = "fan", .class = ACPI_FAN_CLASS, .ids = fan_device_ids, .ops = { .add = acpi_fan_add, static struct platform_driver acpi_fan_driver = { .probe = acpi_fan_probe, .remove = acpi_fan_remove, .driver = { .name = "acpi-fan", .acpi_match_table = fan_device_ids, .pm = FAN_PM_OPS_PTR, }, .drv.pm = FAN_PM_OPS_PTR, }; /* thermal cooling device callbacks */ Loading Loading @@ -126,17 +122,15 @@ static const struct thermal_cooling_device_ops fan_cooling_ops = { Driver Interface -------------------------------------------------------------------------- */ static int acpi_fan_add(struct acpi_device *device) static int acpi_fan_probe(struct platform_device *pdev) { int result = 0; struct thermal_cooling_device *cdev; strcpy(acpi_device_name(device), "Fan"); strcpy(acpi_device_class(device), ACPI_FAN_CLASS); struct acpi_device *device = ACPI_COMPANION(&pdev->dev); result = acpi_device_update_power(device, NULL); if (result) { printk(KERN_ERR PREFIX "Setting initial power state\n"); dev_err(&pdev->dev, "Setting initial power state\n"); goto end; } Loading @@ -147,24 +141,24 @@ static int acpi_fan_add(struct acpi_device *device) goto end; } dev_dbg(&device->dev, "registered as cooling_device%d\n", cdev->id); dev_dbg(&pdev->dev, "registered as cooling_device%d\n", cdev->id); device->driver_data = cdev; result = sysfs_create_link(&device->dev.kobj, platform_set_drvdata(pdev, cdev); result = sysfs_create_link(&pdev->dev.kobj, &cdev->device.kobj, "thermal_cooling"); if (result) dev_err(&device->dev, "Failed to create sysfs link " dev_err(&pdev->dev, "Failed to create sysfs link " "'thermal_cooling'\n"); result = sysfs_create_link(&cdev->device.kobj, &device->dev.kobj, &pdev->dev.kobj, "device"); if (result) dev_err(&device->dev, "Failed to create sysfs link " dev_err(&pdev->dev, "Failed to create sysfs link " "'device'\n"); printk(KERN_INFO PREFIX "%s [%s] (%s)\n", dev_info(&pdev->dev, "%s [%s] (%s)\n", acpi_device_name(device), acpi_device_bid(device), !device->power.state ? "on" : "off"); Loading @@ -172,11 +166,11 @@ static int acpi_fan_add(struct acpi_device *device) return result; } static int acpi_fan_remove(struct acpi_device *device) static int acpi_fan_remove(struct platform_device *pdev) { struct thermal_cooling_device *cdev = acpi_driver_data(device); struct thermal_cooling_device *cdev = platform_get_drvdata(pdev); sysfs_remove_link(&device->dev.kobj, "thermal_cooling"); sysfs_remove_link(&pdev->dev.kobj, "thermal_cooling"); sysfs_remove_link(&cdev->device.kobj, "device"); thermal_cooling_device_unregister(cdev); Loading @@ -186,7 +180,7 @@ static int acpi_fan_remove(struct acpi_device *device) #ifdef CONFIG_PM_SLEEP static int acpi_fan_suspend(struct device *dev) { acpi_device_set_power(to_acpi_device(dev), ACPI_STATE_D0); acpi_device_set_power(ACPI_COMPANION(dev), ACPI_STATE_D0); return AE_OK; } Loading @@ -195,12 +189,12 @@ static int acpi_fan_resume(struct device *dev) { int result; result = acpi_device_update_power(to_acpi_device(dev), NULL); result = acpi_device_update_power(ACPI_COMPANION(dev), NULL); if (result) printk(KERN_ERR PREFIX "Error updating fan power state\n"); dev_err(dev, "Error updating fan power state\n"); return result; } #endif module_acpi_driver(acpi_fan_driver); module_platform_driver(acpi_fan_driver);