Commit bd7246a1 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

Merge tag 'platform-remove-void-step-b' of...

Merge tag 'platform-remove-void-step-b' of https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux into driver-core-next

Uwe writes:

Change struct platform_driver::remove() to return void

This is step b) of the plan outlined in commit 5c5a7680 ("platform:
Provide a remove callback that returns no value"), which completes the
first major step of making the remove callback return no value. Up to
now it returned an int which however was mostly ignored by the driver
core and lured driver authors to believe there is some error handling.

Note that the Linux driver model assumes that removing a device cannot
fail, so this isn't about being lazy and not implementing error handling
in the core and so making .remove return void is the right thing to do.

* tag 'platform-remove-void-step-b' of https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux:
  platform: Make platform_driver::remove() return void
  samples: qmi: Convert to platform remove callback returning void
  nvdimm/of_pmem: Convert to platform remove callback returning void
  nvdimm/e820: Convert to platform remove callback returning void
  gpu: ipu-v3: Convert to platform remove callback returning void
  gpu: host1x: Convert to platform remove callback returning void
  drm/mediatek: Convert to platform remove callback returning void
  drm/imagination: Convert to platform remove callback returning void
  gpu: host1x: mipi: Benefit from devm_clk_get_prepared()
  pps: clients: gpio: Convert to platform remove callback returning void
  fsi: occ: Convert to platform remove callback returning void
  fsi: master-gpio: Convert to platform remove callback returning void
  fsi: master-ast-cf: Convert to platform remove callback returning void
  fsi: master-aspeed: Convert to platform remove callback returning void
  reset: ti-sci: Convert to platform remove callback returning void
  reset: rzg2l-usbphy-ctrl: Convert to platform remove callback returning void
  reset: meson-audio-arb: Convert to platform remove callback returning void
parents 1968845d 0edb555a
Loading
Loading
Loading
Loading
+2 −8
Original line number Diff line number Diff line
@@ -1420,14 +1420,8 @@ static void platform_remove(struct device *_dev)
	struct platform_driver *drv = to_platform_driver(_dev->driver);
	struct platform_device *dev = to_platform_device(_dev);

	if (drv->remove_new) {
		drv->remove_new(dev);
	} else if (drv->remove) {
		int ret = drv->remove(dev);

		if (ret)
			dev_warn(_dev, "remove callback returned a non-zero value. This will be ignored.\n");
	}
	if (drv->remove)
		drv->remove(dev);
	dev_pm_domain_detach(_dev, true);
}

+2 −4
Original line number Diff line number Diff line
@@ -646,14 +646,12 @@ static int fsi_master_aspeed_probe(struct platform_device *pdev)
	return rc;
}

static int fsi_master_aspeed_remove(struct platform_device *pdev)
static void fsi_master_aspeed_remove(struct platform_device *pdev)
{
	struct fsi_master_aspeed *aspeed = platform_get_drvdata(pdev);

	fsi_master_unregister(&aspeed->master);
	clk_disable_unprepare(aspeed->clk);

	return 0;
}

static const struct of_device_id fsi_master_aspeed_match[] = {
@@ -668,7 +666,7 @@ static struct platform_driver fsi_master_aspeed_driver = {
		.of_match_table	= fsi_master_aspeed_match,
	},
	.probe	= fsi_master_aspeed_probe,
	.remove = fsi_master_aspeed_remove,
	.remove_new = fsi_master_aspeed_remove,
};

module_platform_driver(fsi_master_aspeed_driver);
+2 −4
Original line number Diff line number Diff line
@@ -1412,15 +1412,13 @@ static int fsi_master_acf_probe(struct platform_device *pdev)
}


static int fsi_master_acf_remove(struct platform_device *pdev)
static void fsi_master_acf_remove(struct platform_device *pdev)
{
	struct fsi_master_acf *master = platform_get_drvdata(pdev);

	device_remove_file(master->dev, &dev_attr_external_mode);

	fsi_master_unregister(&master->master);

	return 0;
}

static const struct of_device_id fsi_master_acf_match[] = {
@@ -1436,7 +1434,7 @@ static struct platform_driver fsi_master_acf = {
		.of_match_table	= fsi_master_acf_match,
	},
	.probe	= fsi_master_acf_probe,
	.remove = fsi_master_acf_remove,
	.remove_new = fsi_master_acf_remove,
};

module_platform_driver(fsi_master_acf);
+2 −4
Original line number Diff line number Diff line
@@ -867,15 +867,13 @@ static int fsi_master_gpio_probe(struct platform_device *pdev)



static int fsi_master_gpio_remove(struct platform_device *pdev)
static void fsi_master_gpio_remove(struct platform_device *pdev)
{
	struct fsi_master_gpio *master = platform_get_drvdata(pdev);

	device_remove_file(&pdev->dev, &dev_attr_external_mode);

	fsi_master_unregister(&master->master);

	return 0;
}

static const struct of_device_id fsi_master_gpio_match[] = {
@@ -890,7 +888,7 @@ static struct platform_driver fsi_master_gpio_driver = {
		.of_match_table	= fsi_master_gpio_match,
	},
	.probe	= fsi_master_gpio_probe,
	.remove = fsi_master_gpio_remove,
	.remove_new = fsi_master_gpio_remove,
};

module_platform_driver(fsi_master_gpio_driver);
+2 −4
Original line number Diff line number Diff line
@@ -703,7 +703,7 @@ static int occ_probe(struct platform_device *pdev)
	return 0;
}

static int occ_remove(struct platform_device *pdev)
static void occ_remove(struct platform_device *pdev)
{
	struct occ *occ = platform_get_drvdata(pdev);

@@ -720,8 +720,6 @@ static int occ_remove(struct platform_device *pdev)
		device_for_each_child(&pdev->dev, NULL, occ_unregister_of_child);

	ida_simple_remove(&occ_ida, occ->idx);

	return 0;
}

static const struct of_device_id occ_match[] = {
@@ -743,7 +741,7 @@ static struct platform_driver occ_driver = {
		.of_match_table	= occ_match,
	},
	.probe	= occ_probe,
	.remove = occ_remove,
	.remove_new = occ_remove,
};

static int occ_init(void)
Loading