Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1097306pxv; Fri, 25 Jun 2021 05:31:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzOCb0QH5APIAtwTYp5dAznDAUM5Hlvp3aPrHvqz5kJ5/Jl+VzpOI3MVEXGnCXK+G3AxXMu X-Received: by 2002:a05:6402:42d2:: with SMTP id i18mr14237149edc.168.1624624315881; Fri, 25 Jun 2021 05:31:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624624315; cv=none; d=google.com; s=arc-20160816; b=aRDHwcWJrfeFD6wB6hH6m5vrVQhGT159TYk4aYXDE1ThWfbWKG7HW4Zm46RkdUU2+u WZnrhqzEAFyuanglsGRKH+ejkbHQROkAf9mUZ3yKJUlW2QZXdKSU/NfkepvL148IJEpO 7dN4J3Kkp1eXtZ7CRKvX3si1EPe2eQRJ/MQ35/5hBag/+jaLRXvDPGvqcMZZ+DhcyzMu 6XIn5lPcFdt1iVbeVYLeEYvIHzg6NcT4ZhUQsUAUIzI6S1c52uTuJ6Dh6bVL/H/E3NNN 1hHDn3HEiYLxi4G3ozTkWJC8ypS6s0fYleQ8HDAoeBU3T3KSBxC630giv9MRbeQk57bN xDtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FxxfENGrIFXRma0NvkVm5/BU+63/LeldJyuBInY+fuk=; b=RdtCQMyC2AIeeHTh2N3yqk5wu9GTdIST+92B7FBPc/XrW9YorNlCLuMGq2iSgX+mqM dYcc9S6Vp4vG+g3HPI6ItLulV4JYaYvlYiFXG/syD/ahJiPw1+BTX/yq0VqEJb7UIiu1 67lynyoncAEpaHGhM1JR6nAfpjJ7Pc9vBVZIo2RrNrjNpo+EW2to96C/abeEZ6Gvsm4d SOK74kSQ4zLfn7sisxKJ6GBaz33CjwA22vA1Bd594jeuaYP+95za5fQQ/9NZpq+NMN86 LP1+/M+Me1vOS4azGz/0u3vPF6Bq6OSdTrpxjGOEe2bqsu3uFdCf0TlmO43WWNh1gNo7 XmXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@deviqon.com header.s=google header.b=WceRuFB5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=deviqon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n23si5712599ejl.269.2021.06.25.05.31.31; Fri, 25 Jun 2021 05:31:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@deviqon.com header.s=google header.b=WceRuFB5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=deviqon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231359AbhFYMch (ORCPT + 99 others); Fri, 25 Jun 2021 08:32:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229498AbhFYMce (ORCPT ); Fri, 25 Jun 2021 08:32:34 -0400 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E49D7C061767 for ; Fri, 25 Jun 2021 05:30:13 -0700 (PDT) Received: by mail-ed1-x531.google.com with SMTP id c7so13150794edn.6 for ; Fri, 25 Jun 2021 05:30:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=deviqon.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FxxfENGrIFXRma0NvkVm5/BU+63/LeldJyuBInY+fuk=; b=WceRuFB5RWCKYavAIfb8iC8WDX612leSU7MckzCcDSRgwJTlxBfQkOxBXGVbiAwQWg yZPBdEC0O4CxwDc4AaJjvYivh++10FTgVUYnAFonBbG3E8pocA5mQBWzm4lB+hBrlBrG YGqWDtubsqgPKbzbibsUpuASlxzs0XJIXyNqT1d6Zi7mUbftyZ3kDkTcCc4LSU5pnBpG fcnAf0GHiXETfpPwVKeto0eCqvJWAk0TAqOe08KY3p7qam2mLh36SwW6eIeox7y4JnXk iFAS4Qdm7wlR6lq20HsHeNSWXLOB0ZNbmTyi4fl5PCCZuBpNABoswRBtI2YsWQIJk80L yfHQ== 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=FxxfENGrIFXRma0NvkVm5/BU+63/LeldJyuBInY+fuk=; b=LmP+NSLP0noxLKH5gYsS9zV3Ed5bc3XQERmdlXOC8HfIackg5V+JMSM8f8fl+Qjsdn 9A5reoleVMgjEpS1/kvgkgBovsczs3TVqvIG+meVi/Fajc6Gdfx0uFqrCQaVAqbqoveL SWJxMTld3SM7owKpMmwxNXTe+jjaswZmD2bcQEIQeCRwMMmpzgMoXuwrUhgFoCdXWhZw yAQozZV26XBZam1t9mM6GIhmI9+rVbI5G3lWxy+7uD1uN4M7i7WUpcFFMEjuC5rl+/c4 48y0M95j+8yFjFquTgiYyNSl58a//ZvvNbu0yWuNhTojn0QtfjPzKDOOfI/olM8ZcNXZ U+bw== X-Gm-Message-State: AOAM531XdPtVTCNH9ATb/2pD59DdbPQiod8tJU7E321HYkLiYg+YSizG v5Q7MQ0DcGYRZLAaqAzpi/NiJzIEVuuU8/VmqHA= X-Received: by 2002:a05:6402:1a:: with SMTP id d26mr14368798edu.105.1624624212166; Fri, 25 Jun 2021 05:30:12 -0700 (PDT) Received: from neptune.. ([5.2.193.191]) by smtp.gmail.com with ESMTPSA id c15sm3884351edu.19.2021.06.25.05.30.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Jun 2021 05:30:11 -0700 (PDT) From: Alexandru Ardelean To: linux-kernel@vger.kernel.org Cc: lgirdwood@gmail.com, broonie@kernel.org, Alexandru Ardelean Subject: [PATCH 2/4] regulator: devres: remove devm_regulator_unregister() function Date: Fri, 25 Jun 2021 15:23:22 +0300 Message-Id: <20210625122324.327585-3-aardelean@deviqon.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210625122324.327585-1-aardelean@deviqon.com> References: <20210625122324.327585-1-aardelean@deviqon.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This API hook isn't used anywhere and most-likely exists because of the general principle of C APIs, where if an API function does an allocation/registration, it must also have an equivalent deallocation/deregistration counterpart. For devm_ functions this isn't all that true (for all cases), as the idea of these function is to provide an auto-cleanup logic on drivers/system de-init. Removing this also discourages any weird logic that could be created with such an API function. Signed-off-by: Alexandru Ardelean --- drivers/regulator/devres.c | 29 ----------------------------- include/linux/regulator/driver.h | 1 - 2 files changed, 30 deletions(-) diff --git a/drivers/regulator/devres.c b/drivers/regulator/devres.c index 8895f0f5ad1d..bf0d19a7fb69 100644 --- a/drivers/regulator/devres.c +++ b/drivers/regulator/devres.c @@ -205,35 +205,6 @@ struct regulator_dev *devm_regulator_register(struct device *dev, } EXPORT_SYMBOL_GPL(devm_regulator_register); -static int devm_rdev_match(struct device *dev, void *res, void *data) -{ - struct regulator_dev **r = res; - if (!r || !*r) { - WARN_ON(!r || !*r); - return 0; - } - return *r == data; -} - -/** - * devm_regulator_unregister - Resource managed regulator_unregister() - * @dev: device to supply - * @rdev: regulator to free - * - * Unregister a regulator registered with devm_regulator_register(). - * Normally this function will not need to be called and the resource - * management code will ensure that the resource is freed. - */ -void devm_regulator_unregister(struct device *dev, struct regulator_dev *rdev) -{ - int rc; - - rc = devres_release(dev, devm_rdev_release, devm_rdev_match, rdev); - if (rc != 0) - WARN_ON(rc); -} -EXPORT_SYMBOL_GPL(devm_regulator_unregister); - struct regulator_supply_alias_match { struct device *dev; const char *id; diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h index 4aec20387857..5447a6b33fa0 100644 --- a/include/linux/regulator/driver.h +++ b/include/linux/regulator/driver.h @@ -645,7 +645,6 @@ devm_regulator_register(struct device *dev, const struct regulator_desc *regulator_desc, const struct regulator_config *config); void regulator_unregister(struct regulator_dev *rdev); -void devm_regulator_unregister(struct device *dev, struct regulator_dev *rdev); int regulator_notifier_call_chain(struct regulator_dev *rdev, unsigned long event, void *data); -- 2.31.1