Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp481979ybv; Thu, 20 Feb 2020 02:02:15 -0800 (PST) X-Google-Smtp-Source: APXvYqwt5EFKgRMB/DLPnwW8eMjmJqZSOTGBJ7FWJlDjVCHgUp8lKewRIVyc2agb6YewsJj0FB+k X-Received: by 2002:aca:3f8b:: with SMTP id m133mr1343069oia.51.1582192935279; Thu, 20 Feb 2020 02:02:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582192935; cv=none; d=google.com; s=arc-20160816; b=CR7IsHCxkVON5n1qO2VZmp+s6izCqGeoK1diCRhynN5V2Q2IgytXdc+oWxnZS0+0YA q0HB0m6/5wjfPGHHpExex8XeUgvikNKJniTbxxIzMkuDn2mC2Kd6hZNkE65mqKhYTgfJ fBPyp6YM2irnqqLDB9rwtE3EBWHhGmbcH4yeeWQLAaHHSksmXw8zHWViNxhQi1qA7X5j c0bPuvQ2aeGRIcCToS6Srdqvcxw6L5CTYfjMvgAHZ/aZWPANCbv6A5Mx3rZo78WIs6hg ypDwZVc5G/dbZkQx3cFJTYbQLuX4jghx/JTPhJzdRXr1Vm8AldkK9q5SLdR3EkVZe3zB pcww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=O+T58/PVEkY9REC+CSDzxK/asJw/FlGJSf/x2KOhKHI=; b=V5RaR7cJxwrhtbw8FvLDmulccD0/oNFPHiAXgWECTPkDpB6jM5ed9ahapUSmogjwZ0 rDVA8jvYcjF0xf+iyBQwqyQgVwPYrCHsriwS4Pky44dgLmoRJKWtUlSr9niZv+OsjNi4 FsgbtPtdXLpDagTk970OFdQwRT49sCKdR85tCFNiC9U+orH5VoxmE6kvErO/QJIRjFzg zO+fO5c0clmuabki5JxuhPz1QsI1K+tXobi1PBWNjFt7R2MbiFkjD9yKcbNvtYBZdayn NfCM4TFms1d3DIJzAFmhc02SlNVJwgoIsUJCtMff2LijwSIANODyy8EB/SKTIOdq9k/Y I+fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=cw9v+mhd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l23si1332140otj.302.2020.02.20.02.02.03; Thu, 20 Feb 2020 02:02:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=cw9v+mhd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727298AbgBTKBz (ORCPT + 99 others); Thu, 20 Feb 2020 05:01:55 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:50315 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726801AbgBTKBv (ORCPT ); Thu, 20 Feb 2020 05:01:51 -0500 Received: by mail-wm1-f67.google.com with SMTP id a5so1316417wmb.0 for ; Thu, 20 Feb 2020 02:01:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=O+T58/PVEkY9REC+CSDzxK/asJw/FlGJSf/x2KOhKHI=; b=cw9v+mhdDqPF/lvJis9JsmFzwH6Orjo18NHmWpxXbdFBY4qbW8ictGK2MJM/f1sk79 zqytoP5UgLkxJ8NO5lCXCYOVtinGnT9/nTiyLYUk1F5SPEcZ8KUMr8K09T88N2fu2ftj 4uZZLq9UQ+4IL3Z5farc8lEH55/VuDoDF3F5tHrbYchEbv9Tu5xSRSsmcqNCa4dw9w24 TlcgghPck3QBjzvW4Mul7X+VLqjQUZ1Ig1iXZt0UMxSZFsQ767CZOS18BN3RFaCKhHbm X7Y7QrMYRVndQc2HgiGuRuTSX5VEaSR+4PzbmXkdAfurK+4hlPedm8yC4VRsxmIaNb44 3n5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=O+T58/PVEkY9REC+CSDzxK/asJw/FlGJSf/x2KOhKHI=; b=AySHqxPJ9q/oefAev/FvZTkHM2aPfsTDvR5y4zHeXXIlMqwOyv2/6ZbGT1l8ka4SAP jsCpBDBU+t4wK8ZNIerPk+czUxUrW0Fcw4F1OlKZ89FH2xQ1RIyisK3s4oiro7semL2R WcfisgmhRw4NFUmybMXXnzKeTzthjox2Jto3WeIVqYKzb78r5T4y8HWLp0QXb1oGRCd3 2AVoziou+3gr5wPYqeu8oFfN33AwZfGdmgN4KQJ48LHTsY5iOhRgOTEH5SfjqIYscobP z4yHr2dwjKid+xP4NM9PYFBgFyP6ENc9OXCdoXPLeh+p73KZFcW4P2WYqbXqDpuTjqkr JiNw== X-Gm-Message-State: APjAAAVwBMcp+/XaE3wP8O3j/qL76sbH1FdNzjYwXLIKPdwqVBr5Q7EW yYqtlRQjbSebt/V46IziTQkZig== X-Received: by 2002:a05:600c:2104:: with SMTP id u4mr3544388wml.93.1582192910228; Thu, 20 Feb 2020 02:01:50 -0800 (PST) Received: from localhost.localdomain (lfbn-nic-1-188-94.w2-15.abo.wanadoo.fr. [2.15.37.94]) by smtp.gmail.com with ESMTPSA id z1sm3663496wmf.42.2020.02.20.02.01.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Feb 2020 02:01:49 -0800 (PST) From: Bartosz Golaszewski To: Linus Walleij , Srinivas Kandagatla , Khouloud Touil , Geert Uytterhoeven Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v4 4/4] nvmem: release the write-protect pin Date: Thu, 20 Feb 2020 11:01:41 +0100 Message-Id: <20200220100141.5905-5-brgl@bgdev.pl> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200220100141.5905-1-brgl@bgdev.pl> References: <20200220100141.5905-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Khouloud Touil Put the write-protect GPIO descriptor in nvmem_release() so that it can be automatically released when the associated device's reference count drops to 0. Fixes: 2a127da461a9 ("nvmem: add support for the write-protect pin") Reported-by: Geert Uytterhoeven Signed-off-by: Khouloud Touil [Bartosz: tweak the commit message] Signed-off-by: Bartosz Golaszewski --- drivers/nvmem/core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 071fb897394c..a82375f63d64 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -72,6 +72,7 @@ static void nvmem_release(struct device *dev) struct nvmem_device *nvmem = to_nvmem_device(dev); ida_simple_remove(&nvmem_ida, nvmem->id); + gpiod_put(nvmem->wp_gpio); kfree(nvmem); } -- 2.25.0