From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2A88D449B13 for ; Wed, 29 Jul 2026 09:47:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785318424; cv=none; b=UZ0d9KGpLvQnKRASiNSzm0sYIJb/8s3aV0Y5AqcEM9TqeEEbyP8rjxB+Jg0ifE94E9aXhriIHLmZ34k/M43SUuwk3ib8yMv2YnW4+4WeKxbJ9Ah8WE52+BNW/fwXDeF+QLtfBFfAbJs7HRqjSGm5D+V+Hs7mGi3HWniPA46BUiU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785318424; c=relaxed/simple; bh=ej0/Qd6/wruPKGbnY0EZ7VttzXUxaVeiCz+G2Kv8rp8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oMK8guXUWPxCcj6/z5/EtuknY7mURA99x90oJsB4gH4psF2meXEl9INHTAzS+bTBAP8+ak7xCrRDFFbK+FAv43YKKnSFVoB0Io0WtdGUY5nW8WUNwL7sXo7sidndVq6NIsU3IyPs5BRwd8Vvg/QwvqH8T8TUXJHoYU/+ezN1uIA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QILhj9hw; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="QILhj9hw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D2111F00A3D; Wed, 29 Jul 2026 09:47:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1785318422; bh=j9ISKaHvq3tmHYk+Fe7vgH61kTv+vrUWNACEXr1nIuk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=QILhj9hwtdM13vK6H1x8YddaTO0x6zz5vzl2y4R678jkxdiZ+dAgZKgugg8KyYq/l HK0RT3EB2krvzG8zIAbFkuDvMUbuVaX0bvu9g3SmbtU5iWMEHWll7ACBPRBS3m+cI/ UKomTe4vvzP4PEVVfIpfk4xrtDPd+E6i1KsmiDM2ERtm4i8wLn37lhyEkdhZyOimzE NVOA+sDLP4avxdDGBB0a/K7u/iAdvJgwNxlVhrZa0caLGo5uYswqM+XO6okUQKYQfF sve+wo/I9BRuGxvA6CQ7Es0N7wgk1BkoKNKGHf/7wxANgGZpXkvYnfj0+zoNTOLBSv ReYgkC0xXsqeg== From: srini@kernel.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski , Loic Poulain , Srinivas Kandagatla Subject: [PATCH 07/14] nvmem: simplify nvmem_sysfs_remove_compat() Date: Wed, 29 Jul 2026 10:46:40 +0100 Message-ID: <20260729094647.111468-8-srini@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260729094647.111468-1-srini@kernel.org> References: <20260729094647.111468-1-srini@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Bartosz Golaszewski There's no need for the config argument in nvmem_sysfs_remove_compat(). Once the compat attribute is registered, that information is carried in nvmem_device::flags. Rework the code to always query that field and drop the second argument. Signed-off-by: Bartosz Golaszewski Tested-by: Loic Poulain Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 45ff4ceca1b9..0556d140170a 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -460,10 +460,9 @@ static int nvmem_sysfs_setup_compat(struct nvmem_device *nvmem, return 0; } -static void nvmem_sysfs_remove_compat(struct nvmem_device *nvmem, - const struct nvmem_config *config) +static void nvmem_sysfs_remove_compat(struct nvmem_device *nvmem) { - if (config->compat) + if (nvmem->flags & FLAG_COMPAT) device_remove_bin_file(nvmem->base_dev, &nvmem->eeprom); } @@ -530,8 +529,7 @@ static int nvmem_sysfs_setup_compat(struct nvmem_device *nvmem, { return -ENOSYS; } -static void nvmem_sysfs_remove_compat(struct nvmem_device *nvmem, - const struct nvmem_config *config) +static void nvmem_sysfs_remove_compat(struct nvmem_device *nvmem) { } @@ -1036,8 +1034,7 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config) device_del(&nvmem->dev); err_remove_cells: nvmem_device_remove_all_cells(nvmem); - if (config->compat) - nvmem_sysfs_remove_compat(nvmem, config); + nvmem_sysfs_remove_compat(nvmem); err_put_device: put_device(&nvmem->dev); @@ -1053,8 +1050,7 @@ static void nvmem_device_release(struct kref *kref) blocking_notifier_call_chain(&nvmem_notifier, NVMEM_REMOVE, nvmem); - if (nvmem->flags & FLAG_COMPAT) - device_remove_bin_file(nvmem->base_dev, &nvmem->eeprom); + nvmem_sysfs_remove_compat(nvmem); nvmem_device_remove_all_cells(nvmem); nvmem_destroy_layout(nvmem); -- 2.53.0