All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] platform/x86: compal-laptop: Get rid of a few forward declarations
@ 2022-09-23  9:47 Uwe Kleine-König
  2022-09-27 13:11 ` Hans de Goede
  0 siblings, 1 reply; 2+ messages in thread
From: Uwe Kleine-König @ 2022-09-23  9:47 UTC (permalink / raw)
  To: Cezary Jackiewicz, Hans de Goede, Mark Gross; +Cc: platform-driver-x86, kernel

Declarations for static symbols are useless repetition (unless there are
cyclic dependencies).

By changing the order of a few symbols two forward declarations can be
dropped.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/platform/x86/compal-laptop.c | 151 +++++++++++++--------------
 1 file changed, 74 insertions(+), 77 deletions(-)

diff --git a/drivers/platform/x86/compal-laptop.c b/drivers/platform/x86/compal-laptop.c
index 0942f50bd793..72e1523edd31 100644
--- a/drivers/platform/x86/compal-laptop.c
+++ b/drivers/platform/x86/compal-laptop.c
@@ -721,16 +721,6 @@ static struct attribute *compal_hwmon_attrs[] = {
 };
 ATTRIBUTE_GROUPS(compal_hwmon);
 
-static int compal_probe(struct platform_device *);
-static int compal_remove(struct platform_device *);
-static struct platform_driver compal_driver = {
-	.driver = {
-		.name = DRIVER_NAME,
-	},
-	.probe	= compal_probe,
-	.remove	= compal_remove,
-};
-
 static enum power_supply_property compal_bat_properties[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_HEALTH,
@@ -965,6 +955,80 @@ static int setup_rfkill(void)
 	return ret;
 }
 
+static int compal_probe(struct platform_device *pdev)
+{
+	int err;
+	struct compal_data *data;
+	struct device *hwmon_dev;
+	struct power_supply_config psy_cfg = {};
+
+	if (!extra_features)
+		return 0;
+
+	/* Fan control */
+	data = devm_kzalloc(&pdev->dev, sizeof(struct compal_data), GFP_KERNEL);
+	if (!data)
+		return -ENOMEM;
+
+	initialize_fan_control_data(data);
+
+	err = sysfs_create_group(&pdev->dev.kobj, &compal_platform_attr_group);
+	if (err)
+		return err;
+
+	hwmon_dev = devm_hwmon_device_register_with_groups(&pdev->dev,
+							   "compal", data,
+							   compal_hwmon_groups);
+	if (IS_ERR(hwmon_dev)) {
+		err = PTR_ERR(hwmon_dev);
+		goto remove;
+	}
+
+	/* Power supply */
+	initialize_power_supply_data(data);
+	psy_cfg.drv_data = data;
+	data->psy = power_supply_register(&compal_device->dev, &psy_bat_desc,
+					  &psy_cfg);
+	if (IS_ERR(data->psy)) {
+		err = PTR_ERR(data->psy);
+		goto remove;
+	}
+
+	platform_set_drvdata(pdev, data);
+
+	return 0;
+
+remove:
+	sysfs_remove_group(&pdev->dev.kobj, &compal_platform_attr_group);
+	return err;
+}
+
+static int compal_remove(struct platform_device *pdev)
+{
+	struct compal_data *data;
+
+	if (!extra_features)
+		return 0;
+
+	pr_info("Unloading: resetting fan control to motherboard\n");
+	pwm_disable_control();
+
+	data = platform_get_drvdata(pdev);
+	power_supply_unregister(data->psy);
+
+	sysfs_remove_group(&pdev->dev.kobj, &compal_platform_attr_group);
+
+	return 0;
+}
+
+static struct platform_driver compal_driver = {
+	.driver = {
+		.name = DRIVER_NAME,
+	},
+	.probe	= compal_probe,
+	.remove	= compal_remove,
+};
+
 static int __init compal_init(void)
 {
 	int ret;
@@ -1028,54 +1092,6 @@ static int __init compal_init(void)
 	return ret;
 }
 
-static int compal_probe(struct platform_device *pdev)
-{
-	int err;
-	struct compal_data *data;
-	struct device *hwmon_dev;
-	struct power_supply_config psy_cfg = {};
-
-	if (!extra_features)
-		return 0;
-
-	/* Fan control */
-	data = devm_kzalloc(&pdev->dev, sizeof(struct compal_data), GFP_KERNEL);
-	if (!data)
-		return -ENOMEM;
-
-	initialize_fan_control_data(data);
-
-	err = sysfs_create_group(&pdev->dev.kobj, &compal_platform_attr_group);
-	if (err)
-		return err;
-
-	hwmon_dev = devm_hwmon_device_register_with_groups(&pdev->dev,
-							   "compal", data,
-							   compal_hwmon_groups);
-	if (IS_ERR(hwmon_dev)) {
-		err = PTR_ERR(hwmon_dev);
-		goto remove;
-	}
-
-	/* Power supply */
-	initialize_power_supply_data(data);
-	psy_cfg.drv_data = data;
-	data->psy = power_supply_register(&compal_device->dev, &psy_bat_desc,
-					  &psy_cfg);
-	if (IS_ERR(data->psy)) {
-		err = PTR_ERR(data->psy);
-		goto remove;
-	}
-
-	platform_set_drvdata(pdev, data);
-
-	return 0;
-
-remove:
-	sysfs_remove_group(&pdev->dev.kobj, &compal_platform_attr_group);
-	return err;
-}
-
 static void __exit compal_cleanup(void)
 {
 	platform_device_unregister(compal_device);
@@ -1089,25 +1105,6 @@ static void __exit compal_cleanup(void)
 	pr_info("Driver unloaded\n");
 }
 
-static int compal_remove(struct platform_device *pdev)
-{
-	struct compal_data *data;
-
-	if (!extra_features)
-		return 0;
-
-	pr_info("Unloading: resetting fan control to motherboard\n");
-	pwm_disable_control();
-
-	data = platform_get_drvdata(pdev);
-	power_supply_unregister(data->psy);
-
-	sysfs_remove_group(&pdev->dev.kobj, &compal_platform_attr_group);
-
-	return 0;
-}
-
-
 module_init(compal_init);
 module_exit(compal_cleanup);
 

base-commit: 568035b01cfb107af8d2e4bd2fb9aea22cf5b868
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] platform/x86: compal-laptop: Get rid of a few forward declarations
  2022-09-23  9:47 [PATCH] platform/x86: compal-laptop: Get rid of a few forward declarations Uwe Kleine-König
@ 2022-09-27 13:11 ` Hans de Goede
  0 siblings, 0 replies; 2+ messages in thread
From: Hans de Goede @ 2022-09-27 13:11 UTC (permalink / raw)
  To: Uwe Kleine-König, Cezary Jackiewicz, Mark Gross
  Cc: platform-driver-x86, kernel

Hi,

On 9/23/22 11:47, Uwe Kleine-König wrote:
> Declarations for static symbols are useless repetition (unless there are
> cyclic dependencies).
> 
> By changing the order of a few symbols two forward declarations can be
> dropped.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Thank you for your patch, I've applied this patch to my review-hans 
branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.

Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.

Regards,

Hans



> ---
>  drivers/platform/x86/compal-laptop.c | 151 +++++++++++++--------------
>  1 file changed, 74 insertions(+), 77 deletions(-)
> 
> diff --git a/drivers/platform/x86/compal-laptop.c b/drivers/platform/x86/compal-laptop.c
> index 0942f50bd793..72e1523edd31 100644
> --- a/drivers/platform/x86/compal-laptop.c
> +++ b/drivers/platform/x86/compal-laptop.c
> @@ -721,16 +721,6 @@ static struct attribute *compal_hwmon_attrs[] = {
>  };
>  ATTRIBUTE_GROUPS(compal_hwmon);
>  
> -static int compal_probe(struct platform_device *);
> -static int compal_remove(struct platform_device *);
> -static struct platform_driver compal_driver = {
> -	.driver = {
> -		.name = DRIVER_NAME,
> -	},
> -	.probe	= compal_probe,
> -	.remove	= compal_remove,
> -};
> -
>  static enum power_supply_property compal_bat_properties[] = {
>  	POWER_SUPPLY_PROP_STATUS,
>  	POWER_SUPPLY_PROP_HEALTH,
> @@ -965,6 +955,80 @@ static int setup_rfkill(void)
>  	return ret;
>  }
>  
> +static int compal_probe(struct platform_device *pdev)
> +{
> +	int err;
> +	struct compal_data *data;
> +	struct device *hwmon_dev;
> +	struct power_supply_config psy_cfg = {};
> +
> +	if (!extra_features)
> +		return 0;
> +
> +	/* Fan control */
> +	data = devm_kzalloc(&pdev->dev, sizeof(struct compal_data), GFP_KERNEL);
> +	if (!data)
> +		return -ENOMEM;
> +
> +	initialize_fan_control_data(data);
> +
> +	err = sysfs_create_group(&pdev->dev.kobj, &compal_platform_attr_group);
> +	if (err)
> +		return err;
> +
> +	hwmon_dev = devm_hwmon_device_register_with_groups(&pdev->dev,
> +							   "compal", data,
> +							   compal_hwmon_groups);
> +	if (IS_ERR(hwmon_dev)) {
> +		err = PTR_ERR(hwmon_dev);
> +		goto remove;
> +	}
> +
> +	/* Power supply */
> +	initialize_power_supply_data(data);
> +	psy_cfg.drv_data = data;
> +	data->psy = power_supply_register(&compal_device->dev, &psy_bat_desc,
> +					  &psy_cfg);
> +	if (IS_ERR(data->psy)) {
> +		err = PTR_ERR(data->psy);
> +		goto remove;
> +	}
> +
> +	platform_set_drvdata(pdev, data);
> +
> +	return 0;
> +
> +remove:
> +	sysfs_remove_group(&pdev->dev.kobj, &compal_platform_attr_group);
> +	return err;
> +}
> +
> +static int compal_remove(struct platform_device *pdev)
> +{
> +	struct compal_data *data;
> +
> +	if (!extra_features)
> +		return 0;
> +
> +	pr_info("Unloading: resetting fan control to motherboard\n");
> +	pwm_disable_control();
> +
> +	data = platform_get_drvdata(pdev);
> +	power_supply_unregister(data->psy);
> +
> +	sysfs_remove_group(&pdev->dev.kobj, &compal_platform_attr_group);
> +
> +	return 0;
> +}
> +
> +static struct platform_driver compal_driver = {
> +	.driver = {
> +		.name = DRIVER_NAME,
> +	},
> +	.probe	= compal_probe,
> +	.remove	= compal_remove,
> +};
> +
>  static int __init compal_init(void)
>  {
>  	int ret;
> @@ -1028,54 +1092,6 @@ static int __init compal_init(void)
>  	return ret;
>  }
>  
> -static int compal_probe(struct platform_device *pdev)
> -{
> -	int err;
> -	struct compal_data *data;
> -	struct device *hwmon_dev;
> -	struct power_supply_config psy_cfg = {};
> -
> -	if (!extra_features)
> -		return 0;
> -
> -	/* Fan control */
> -	data = devm_kzalloc(&pdev->dev, sizeof(struct compal_data), GFP_KERNEL);
> -	if (!data)
> -		return -ENOMEM;
> -
> -	initialize_fan_control_data(data);
> -
> -	err = sysfs_create_group(&pdev->dev.kobj, &compal_platform_attr_group);
> -	if (err)
> -		return err;
> -
> -	hwmon_dev = devm_hwmon_device_register_with_groups(&pdev->dev,
> -							   "compal", data,
> -							   compal_hwmon_groups);
> -	if (IS_ERR(hwmon_dev)) {
> -		err = PTR_ERR(hwmon_dev);
> -		goto remove;
> -	}
> -
> -	/* Power supply */
> -	initialize_power_supply_data(data);
> -	psy_cfg.drv_data = data;
> -	data->psy = power_supply_register(&compal_device->dev, &psy_bat_desc,
> -					  &psy_cfg);
> -	if (IS_ERR(data->psy)) {
> -		err = PTR_ERR(data->psy);
> -		goto remove;
> -	}
> -
> -	platform_set_drvdata(pdev, data);
> -
> -	return 0;
> -
> -remove:
> -	sysfs_remove_group(&pdev->dev.kobj, &compal_platform_attr_group);
> -	return err;
> -}
> -
>  static void __exit compal_cleanup(void)
>  {
>  	platform_device_unregister(compal_device);
> @@ -1089,25 +1105,6 @@ static void __exit compal_cleanup(void)
>  	pr_info("Driver unloaded\n");
>  }
>  
> -static int compal_remove(struct platform_device *pdev)
> -{
> -	struct compal_data *data;
> -
> -	if (!extra_features)
> -		return 0;
> -
> -	pr_info("Unloading: resetting fan control to motherboard\n");
> -	pwm_disable_control();
> -
> -	data = platform_get_drvdata(pdev);
> -	power_supply_unregister(data->psy);
> -
> -	sysfs_remove_group(&pdev->dev.kobj, &compal_platform_attr_group);
> -
> -	return 0;
> -}
> -
> -
>  module_init(compal_init);
>  module_exit(compal_cleanup);
>  
> 
> base-commit: 568035b01cfb107af8d2e4bd2fb9aea22cf5b868


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-09-27 13:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-23  9:47 [PATCH] platform/x86: compal-laptop: Get rid of a few forward declarations Uwe Kleine-König
2022-09-27 13:11 ` Hans de Goede

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.