From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756591AbdLVPK0 (ORCPT ); Fri, 22 Dec 2017 10:10:26 -0500 Received: from esa1.microchip.iphmx.com ([68.232.147.91]:56578 "EHLO esa1.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756515AbdLVPKS (ORCPT ); Fri, 22 Dec 2017 10:10:18 -0500 X-IronPort-AV: E=Sophos;i="5.45,441,1508828400"; d="scan'208";a="10402501" From: Eugen Hristev To: , , , , , , , , , CC: Eugen Hristev Subject: [PATCH 10/14] iio: adc: at91-sama5d2_adc: force trigger removal on module remove Date: Fri, 22 Dec 2017 17:07:17 +0200 Message-ID: <1513955241-10985-11-git-send-email-eugen.hristev@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513955241-10985-1-git-send-email-eugen.hristev@microchip.com> References: <1513955241-10985-1-git-send-email-eugen.hristev@microchip.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On module remove, if we do not call trigger remove, the trigger stays in the subsystem, and on further module insert, we will have multiple triggers, and the old one is not usable. Have to call the remove function on module remove to solve this. Signed-off-by: Eugen Hristev --- drivers/iio/adc/at91-sama5d2_adc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c index 4eff835..7b9febc 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -1180,6 +1180,9 @@ static int at91_adc_remove(struct platform_device *pdev) struct iio_dev *indio_dev = platform_get_drvdata(pdev); struct at91_adc_state *st = iio_priv(indio_dev); + if (st->selected_trig->hw_trig) + devm_iio_trigger_unregister(&indio_dev->dev, st->trig); + iio_device_unregister(indio_dev); at91_adc_dma_disable(pdev); -- 2.7.4