From patchwork Sun Nov 11 15:59:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Slawomir Stepien X-Patchwork-Id: 10677725 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 63A3E109C for ; Sun, 11 Nov 2018 15:58:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 45A4C2A3D9 for ; Sun, 11 Nov 2018 15:58:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 20EF82A3EF; Sun, 11 Nov 2018 15:58:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA7FE2A3D9 for ; Sun, 11 Nov 2018 15:58:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728753AbeKLBrt (ORCPT ); Sun, 11 Nov 2018 20:47:49 -0500 Received: from smtpo.poczta.interia.pl ([217.74.65.236]:59125 "EHLO smtpo.poczta.interia.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728722AbeKLBrt (ORCPT ); Sun, 11 Nov 2018 20:47:49 -0500 X-Interia-R: Interia X-Interia-R-IP: 188.121.17.172 X-Interia-R-Helo: Received: from localhost (ipv4-188-121-17-172.net.internetunion.pl [188.121.17.172]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by www.poczta.fm (INTERIA.PL) with ESMTPSA; Sun, 11 Nov 2018 16:58:46 +0100 (CET) From: Slawomir Stepien To: lars@metafoo.de, Michael.Hennerich@analog.com, jic23@kernel.org, knaack.h@gmx.de, pmeerw@pmeerw.net Cc: linux-iio@vger.kernel.org, gregkh@linuxfoundation.org Subject: [PATCH v6 0/2] staging: iio: adc: ad7280a: use devm API when applicable Date: Sun, 11 Nov 2018 16:59:09 +0100 Message-Id: <20181111155911.3604-1-sst@poczta.fm> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 X-Interia-Antivirus: OK DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=interia.pl; s=biztos; t=1541951928; bh=eIfj97HRQgGxZ3oZw50sKwRNkKQt0FC8vTeZfRjPb+I=; h=X-Interia-R:X-Interia-R-IP:X-Interia-R-Helo:From:To:Cc:Subject: Date:Message-Id:X-Mailer:MIME-Version:Content-Transfer-Encoding: X-Interia-Antivirus; b=J/98xt4j49sQTmMTp7PPx2iygqcGzKoAq+fZLYTTaDgFLURbEOTFH+cZyrpXFnyQ5 yhWzGPrGMbHHxp4VrXQobip6/i8XVBVDL5jjFwdNfu1vON7IaieHIRg65ENZZfuOLo VXutldJZH14qMu1S5bBvD1kw6zzkCzOsohAnGUaI= Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This small series of patches will enable devm API in the driver when applicable. The patch contains two parts: 1st part enables powering down the device in probe function, 2nd part changes the API to devm when applicable. The first commit has been added for better visualization of what will happen when the devm API is used - the whole remove function is not needed, but we still need to power down the device from somewhere. History: Since v5: * split the patch into two commits: (1) power down the device in probe, (2) use devm API when applicable * devm_add_action -> devm_add_action_or_reset Since v4: * on devm_add_action fail, call the action on error handling * move the devm_add_action just after spi_setup - this will call the action on more error paths in probe (fail in: ad7280_chain_setup, ad7280_channel_init, ad7280_attr_init) Since v3: * use devm_add_action with software power down * the whole remove call back is not needed anymore Since v2: * iio_device_register -> devm_iio_device_register Since v1: * request_threaded_irq -> devm_request_threaded_irq Slawomir Stepien (2): staging: iio: adc: ad7280a: power down the device on error in probe staging: iio: adc: ad7280a: use devm_* APIs drivers/staging/iio/adc/ad7280a.c | 95 +++++++++++++------------------ 1 file changed, 39 insertions(+), 56 deletions(-)