Skip to content

Commit

Permalink
iio: adc: cf_axi_adc_core: Add device link to converter device
Browse files Browse the repository at this point in the history
Create consumer/supplier device link between converter and AXI
interface driver. This will ensure proper device removal.

Signed-off-by: Michael Hennerich <[email protected]>
  • Loading branch information
mhennerich committed Jan 15, 2024
1 parent 3be462b commit 3b5b8ce
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/iio/adc/cf_axi_adc_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1082,6 +1082,7 @@ static int axiadc_probe(struct platform_device *pdev)
struct resource *mem;
struct axiadc_spidev *axiadc_spidev;
struct axiadc_converter *conv;
struct device_link *link;
unsigned int config, skip = 1;
int ret;

Expand Down Expand Up @@ -1119,6 +1120,12 @@ static int axiadc_probe(struct platform_device *pdev)

get_device(axiadc_spidev->dev_spi);

link = device_link_add(&pdev->dev, axiadc_spidev->dev_spi,
DL_FLAG_AUTOREMOVE_SUPPLIER);
if (!link)
dev_warn(&pdev->dev, "failed to create device link to %s\n",
dev_name(axiadc_spidev->dev_spi));

ret = devm_add_action_or_reset(&pdev->dev, axiadc_release_converter, axiadc_spidev);
if (ret)
return ret;
Expand Down

0 comments on commit 3b5b8ce

Please sign in to comment.