From patchwork Tue Dec 19 12:01:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 180886 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp1883460dyi; Tue, 19 Dec 2023 04:02:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IE9UqgeDcIXqsVQBgTFrvH3GraDl83Ybt5fp/fHJq2T9rG9wd/4eov5wkRIA96kmYl6Lcl6 X-Received: by 2002:a05:6a20:914b:b0:190:228e:4c11 with SMTP id x11-20020a056a20914b00b00190228e4c11mr9713418pzc.90.1702987330275; Tue, 19 Dec 2023 04:02:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702987330; cv=none; d=google.com; s=arc-20160816; b=yYeCTmCvnxt4CEVUrGXbes+YkD+sYtoAH56NmFckh1VxFYwXz1nFoDtRjb6CH7qFdC ygv1D/iSvjf5kSikeKwvgh1WffJrYOIcPuiVueScFCKtuktrIvA+jrlA2lCl6UYJVrJy ByLOoeCsjn/xPnIGsHllattPPk2NkxVjvMx+04Lu+MzXA8yHoK0Ur5hXA988Ml9+RbKb 4Hq3QkuT23LBcn1i3YBQP/FxpAx6L1rycmhnr2BjwAPRMEhv4BmOlp5A6S+NriUq/4k7 6wDW2WACiNBQdgxwoCkznEfIKHTfmNBueQYRLwLWEPJWTOGufX/nf62w+d49+Z1wdKhw s4tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=Ggc4MgLow8E4fR59OH6SNMuCU7W9ARSM1t4iHs9v3xw=; fh=QqsJB2wsj2uwf7b+bn803aXRbPtar25mYRjyWdDZX6g=; b=PdkqdMuqrfFrhm3DuF1VRv74r9DGkf2ybrKnhiVqOL31gZ7hI1VcEFznMPwTTuVib/ 9V9oAH/3YLQx5EpUrZt1YQP3vjfM/JBOtI4v3reGv89rrO1X1jYY+J2/GhuGbO5ES58M Wgz2lOLe89Q0UlBv3zdzq69kwLImcrqxAx71KlWyKKkgeuP/aIqodvEvpmpxD7rVfnf+ B8KlTMuZuMlmt2TPDw/2emK7Tlz89PO0EkqA/UlLxtygbfJW30DayOXK6zDNawNABY7w WPxev8hoqK2XVkafPK+cBISIN4PWr5jTQUyrBRwh0Lp5S7J4UlajY6Gb0CQipxTHkX8x XmXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Pu4R23wm; spf=pass (google.com: domain of linux-kernel+bounces-5133-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5133-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id z186-20020a6333c3000000b005cd7fc2c654si5706163pgz.459.2023.12.19.04.02.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 04:02:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5133-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Pu4R23wm; spf=pass (google.com: domain of linux-kernel+bounces-5133-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5133-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id EBC8F286E90 for ; Tue, 19 Dec 2023 12:02:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DA0A11A732; Tue, 19 Dec 2023 12:01:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Pu4R23wm" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 820231A58B for ; Tue, 19 Dec 2023 12:01:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f47.google.com with SMTP id 4fb4d7f45d1cf-54c77e0835bso5425892a12.2 for ; Tue, 19 Dec 2023 04:01:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702987280; x=1703592080; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Ggc4MgLow8E4fR59OH6SNMuCU7W9ARSM1t4iHs9v3xw=; b=Pu4R23wmRkGbtNwaOBlmVDK368m9BQRw5SwnCY23I9aTpkuh3Gfc1pfypjyTS/fS1C AksBEjnY3dZ9Jbzx7vlMdyIU496euKfIFCau2/ffLwqA7g0rN4USBpaEb4y4Hk0/oji9 3JMsS0jKhHXHqVNVRumVvV/IoujYQmAxZUo5HFwW++3qpr5MVTPTXs8/n7fMbatzfZIf 64Cwsxye0KPdXBidRmKGBULgu0p5htxGVmkO3bU3UO/roTZkgJtCXX98Go+BVWO5JaWU bbyj8csvUmRr3uslIZogfZXMX3TGxgR2PfrVwcvl052HAHduzg3iQD8x6azuOdCdq1YG xQcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702987280; x=1703592080; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Ggc4MgLow8E4fR59OH6SNMuCU7W9ARSM1t4iHs9v3xw=; b=HVfYi7aIfUqB7M8K8xBgQzFsdU+reWi0N9uJZz0CX40nylFZZkPOD3Ejx8ygfTYTv3 RuduVRA9yyzfs+n+zJ6IZyn8LmAz6XIh5DiQ0Faw0VQAOE6irfUPey6/SwcpHmSqH/Zg PN1vzzzlUrbB/dni3xzrzU6iyP4Lz4wz89otUQTaCuYzXxuNzLKJ6zhkOPrcwwiG06GE tI/XrvCvgtAfzuTaeJMgGLD+6ieqCGsRMZTLKUAt+SpaZ/2WaBxNrJoW6viUC7F6cRrV OCx0so6KvEnfF8w7YqT63JmGX/WEU2FFzooHdOxRz5i8gc799WUs6us+nyqorKIaSRjX RhqA== X-Gm-Message-State: AOJu0YwwNCA/rz2loWz15D4JzfmeueTmMu5WT4efXL66HzRK13QBgNL4 YrPcVw29ZLV5Nfr5sfSKhwU= X-Received: by 2002:a17:906:c3:b0:a1f:830a:b621 with SMTP id 3-20020a17090600c300b00a1f830ab621mr8866169eji.109.1702987279434; Tue, 19 Dec 2023 04:01:19 -0800 (PST) Received: from localhost.lan (031011218106.poznan.vectranet.pl. [31.11.218.106]) by smtp.gmail.com with ESMTPSA id ux4-20020a170907cf8400b00a230f3799a4sm6767478ejc.225.2023.12.19.04.01.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 04:01:19 -0800 (PST) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: Srinivas Kandagatla , Greg Kroah-Hartman Cc: Michael Walle , Miquel Raynal , linux-mtd@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= Subject: [PATCH v6.8 1/2] nvmem: layouts: refactor .add_cells() callback arguments Date: Tue, 19 Dec 2023 13:01:03 +0100 Message-Id: <20231219120104.3422-1-zajec5@gmail.com> X-Mailer: git-send-email 2.35.3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785711642644917813 X-GMAIL-MSGID: 1785711642644917813 From: Rafał Miłecki Simply pass whole "struct nvmem_layout" instead of single variables. There is nothing in "struct nvmem_layout" that we have to hide from layout drivers. They also access it during .probe() and .remove(). Thanks to this change: 1. API gets more consistent All layouts drivers callbacks get the same argument 2. Layouts get correct device Before this change NVMEM core code was passing NVMEM device instead of layout device. That resulted in: * Confusing prints * Calling devm_*() helpers on wrong device * Helpers like of_device_get_match_data() dereferencing NULLs 3. It gets possible to get match data First of all nvmem_layout_get_match_data() requires passing "struct nvmem_layout" which .add_cells() callback didn't have before this. It doesn't matter much as it's rather useless now anyway (and will be dropped). What's more important however is that of_device_get_match_data() can be used now thanks to owning a proper device pointer. Signed-off-by: Rafał Miłecki Reviewed-by: Michael Walle Reviewed-by: Miquel Raynal --- Those changes complete layouts refactoring process so I'd very much like them to go with the rest of refactoring stuff to v6.8. It's difficult to add Fixes tag due to the nature of refactoring. Callback .add_cells() existed even before refactoring so I'm not sure what commit would be fair to blame. Srini, Greg: could you see if this could still make it into v6.8? drivers/nvmem/core.c | 2 +- drivers/nvmem/layouts/onie-tlv.c | 4 +++- drivers/nvmem/layouts/sl28vpd.c | 4 +++- include/linux/nvmem-provider.h | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index ba559e81f77f..441d132ebb61 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -854,7 +854,7 @@ int nvmem_layout_register(struct nvmem_layout *layout) return -EINVAL; /* Populate the cells */ - ret = layout->add_cells(&layout->nvmem->dev, layout->nvmem); + ret = layout->add_cells(layout); if (ret) return ret; diff --git a/drivers/nvmem/layouts/onie-tlv.c b/drivers/nvmem/layouts/onie-tlv.c index b24cc5dcc6ee..9d2ad5f2dc10 100644 --- a/drivers/nvmem/layouts/onie-tlv.c +++ b/drivers/nvmem/layouts/onie-tlv.c @@ -182,8 +182,10 @@ static bool onie_tlv_crc_is_valid(struct device *dev, size_t table_len, u8 *tabl return true; } -static int onie_tlv_parse_table(struct device *dev, struct nvmem_device *nvmem) +static int onie_tlv_parse_table(struct nvmem_layout *layout) { + struct nvmem_device *nvmem = layout->nvmem; + struct device *dev = &layout->dev; struct onie_tlv_hdr hdr; size_t table_len, data_len, hdr_len; u8 *table, *data; diff --git a/drivers/nvmem/layouts/sl28vpd.c b/drivers/nvmem/layouts/sl28vpd.c index b8ffae646cc2..53fa50f17dca 100644 --- a/drivers/nvmem/layouts/sl28vpd.c +++ b/drivers/nvmem/layouts/sl28vpd.c @@ -80,8 +80,10 @@ static int sl28vpd_v1_check_crc(struct device *dev, struct nvmem_device *nvmem) return 0; } -static int sl28vpd_add_cells(struct device *dev, struct nvmem_device *nvmem) +static int sl28vpd_add_cells(struct nvmem_layout *layout) { + struct nvmem_device *nvmem = layout->nvmem; + struct device *dev = &layout->dev; const struct nvmem_cell_info *pinfo; struct nvmem_cell_info info = {0}; struct device_node *layout_np; diff --git a/include/linux/nvmem-provider.h b/include/linux/nvmem-provider.h index 6fe65b35ea97..81a67642ac55 100644 --- a/include/linux/nvmem-provider.h +++ b/include/linux/nvmem-provider.h @@ -173,7 +173,7 @@ struct nvmem_cell_table { struct nvmem_layout { struct device dev; struct nvmem_device *nvmem; - int (*add_cells)(struct device *dev, struct nvmem_device *nvmem); + int (*add_cells)(struct nvmem_layout *layout); }; struct nvmem_layout_driver { From patchwork Tue Dec 19 12:01:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 180887 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp1883728dyi; Tue, 19 Dec 2023 04:02:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IGFRlFraArgHS9VFHZs/lRv2n3Hwca7Loq6iameFEnZEF85B2tf2zGVB0Z9JwqYSPQvJ42E X-Received: by 2002:a2e:8511:0:b0:2cc:6de9:8069 with SMTP id j17-20020a2e8511000000b002cc6de98069mr1806000lji.59.1702987347337; Tue, 19 Dec 2023 04:02:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702987347; cv=none; d=google.com; s=arc-20160816; b=q47VwX1ri2ad00+oO2QqzMMEsSw488o6QrIAN3tIr07whJmS8xvERW07+lcH7u+yP9 XYEKxbEyBEFA6hJ7LwdYAfG019Sx/HkW50U5jR9CHVWE8zTj74eMxhNNVz1PVsIO2RSU sOZ9wwzv1CbBkKLvZKmjpbPklvT1Y6kUO5w8Bg236zkumonQ7HzQ0/0WR3sFo2pQLC0g o156l64hT71Ogt0qzM9FBH44G/bfHVuf4wvz8NE7u/UzXdSPIoWFAa+om+ECPFkFOYb1 i35cUS9e2UZrA78JAPK/46e3yQ9nAW3t5rRWGOz/aJ7AplrpY17A6H4cDKvBl+R6O5Mk 5sQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=T7yEMgXZhKtlt+r30N1IJsOJuMAaTYKKq9iU4tTYh4A=; fh=QqsJB2wsj2uwf7b+bn803aXRbPtar25mYRjyWdDZX6g=; b=RJkhCiwWfnJ3WESSDJsCqxQkcmRwzSp18rwITrTxTxWPtGNFsVnVvoC3uRXKq+fO17 FRJpVTpvYJkZYdav9BPneDAUeRQ6kaDhCJRnBtAo2xGSwEyrALWIbApuhYXigjZ9tHwT 17q6xe8aR/HJHnNnyaHuxxq8MouBvifdI3VsbEOlMjy5cBjOQekCUu2KMdDaMwKLmNHo SQxNOhWgnEgTJMwuVxMg7EBo4eGZkTLCjUh0XelKYNYadT4m4wPCg9DUCy0iJsnMuFVQ HvCc2h/N8TIWspTuV1fNX8LDRWDnA8opbl7Upi2BazUjQTZ8zz8zxrOkWRRw7V3eHB7B 5+TQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=VPucfGVz; spf=pass (google.com: domain of linux-kernel+bounces-5134-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5134-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id y19-20020a056402441300b0055220681e9fsi6127509eda.644.2023.12.19.04.02.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 04:02:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5134-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=VPucfGVz; spf=pass (google.com: domain of linux-kernel+bounces-5134-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5134-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id C1F371F247EC for ; Tue, 19 Dec 2023 12:02:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 58D491BDC3; Tue, 19 Dec 2023 12:01:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VPucfGVz" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 188991A72B for ; Tue, 19 Dec 2023 12:01:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-40c60dfa5bfso53215015e9.0 for ; Tue, 19 Dec 2023 04:01:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702987283; x=1703592083; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=T7yEMgXZhKtlt+r30N1IJsOJuMAaTYKKq9iU4tTYh4A=; b=VPucfGVzYJDft5Ds3mcmWqUZ4/9Hq5QAnzWFf9EhLHe9qdIZOQ9E9mQpQwrLBQMOS8 gQuCy2W1Xylhp/4uLmsK4Ear7uaIuoO/xQuO1RswWTtRZnNS/T6vr1sBoOzGQjA86o6v bidbS5AiIHeqh2UDpQZ+w6ocC93tn+K6LkUzrZE6IxQmaH2Up7WcPRYCsJlGMAODPi6p UtMzML9kbPe/QYZc46HqtfkxGq86fdZjPfHm6H7/D8/Qiw7nPGv+61/9Tk9FyBEZG5Oj piqB5ScaPI8CHZcQczLmD+6HKB2ZATRfAbgLoWhx9GAQkrCNPu05i43rq/289xzvxE7n VgXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702987283; x=1703592083; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=T7yEMgXZhKtlt+r30N1IJsOJuMAaTYKKq9iU4tTYh4A=; b=LoNRsMAt4eCxpq4lOcRwg/4hyNBj0Rgbddj5uw54KcQ8jI80kBKpAkECYR0utS9J/l AqZls0+esjxlD89N8FbL7HZvE1tK+tuXLDVywFFGgYFOxmJAh3W1fGvnpuU85NMHmygr h19KoONlfWYocOzGmhJT4Ath2mWxSvXw0TGw1Z02cU0WXFRDvq059OhljfmPXITXepUZ Km0zhBsVkkCtg8XcHwO/ecZM2LO7owkuAi8MUyTpUKxbJ494p7NNYEP/pzPE7GhAAFd/ msPvfVuxg5aAcNwyEQ12t7SKxnyHbVqy0eF8WWCH6LMJznEL2t8F/Q7qgF4vWv9eMl6E PFHA== X-Gm-Message-State: AOJu0YxzXAh2zzk8TyqPTlzg8bvHTxoxRwtsDIuRCI/02sP81mbPcP2G 3dPLAElY5TWJqH5IUxvuFSo= X-Received: by 2002:a05:600c:d4:b0:40b:5e59:c55b with SMTP id u20-20020a05600c00d400b0040b5e59c55bmr9283867wmm.133.1702987283001; Tue, 19 Dec 2023 04:01:23 -0800 (PST) Received: from localhost.lan (031011218106.poznan.vectranet.pl. [31.11.218.106]) by smtp.gmail.com with ESMTPSA id ux4-20020a170907cf8400b00a230f3799a4sm6767478ejc.225.2023.12.19.04.01.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 04:01:22 -0800 (PST) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: Srinivas Kandagatla , Greg Kroah-Hartman Cc: Michael Walle , Miquel Raynal , linux-mtd@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= Subject: [PATCH v6.8 2/2] nvmem: drop nvmem_layout_get_match_data() Date: Tue, 19 Dec 2023 13:01:04 +0100 Message-Id: <20231219120104.3422-2-zajec5@gmail.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231219120104.3422-1-zajec5@gmail.com> References: <20231219120104.3422-1-zajec5@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785711660520116102 X-GMAIL-MSGID: 1785711660520116102 From: Rafał Miłecki Thanks for layouts refactoring we now have "struct device" associated with layout. Also its OF pointer points directly to the "nvmem-layout" DT node. All it takes to get match data is a generic of_device_get_match_data(). Signed-off-by: Rafał Miłecki Reviewed-by: Michael Walle Reviewed-by: Miquel Raynal --- drivers/nvmem/core.c | 13 ------------- include/linux/nvmem-provider.h | 10 ---------- 2 files changed, 23 deletions(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 441d132ebb61..4ed54076346d 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -876,19 +876,6 @@ void nvmem_layout_unregister(struct nvmem_layout *layout) } EXPORT_SYMBOL_GPL(nvmem_layout_unregister); -const void *nvmem_layout_get_match_data(struct nvmem_device *nvmem, - struct nvmem_layout *layout) -{ - struct device_node __maybe_unused *layout_np; - const struct of_device_id *match; - - layout_np = of_nvmem_layout_get_container(nvmem); - match = of_match_node(layout->dev.driver->of_match_table, layout_np); - - return match ? match->data : NULL; -} -EXPORT_SYMBOL_GPL(nvmem_layout_get_match_data); - /** * nvmem_register() - Register a nvmem device for given nvmem_config. * Also creates a binary entry in /sys/bus/nvmem/devices/dev-name/nvmem diff --git a/include/linux/nvmem-provider.h b/include/linux/nvmem-provider.h index 81a67642ac55..f0ba0e03218f 100644 --- a/include/linux/nvmem-provider.h +++ b/include/linux/nvmem-provider.h @@ -205,9 +205,6 @@ void nvmem_layout_driver_unregister(struct nvmem_layout_driver *drv); module_driver(__nvmem_layout_driver, nvmem_layout_driver_register, \ nvmem_layout_driver_unregister) -const void *nvmem_layout_get_match_data(struct nvmem_device *nvmem, - struct nvmem_layout *layout); - #else static inline struct nvmem_device *nvmem_register(const struct nvmem_config *c) @@ -238,13 +235,6 @@ static inline int nvmem_layout_register(struct nvmem_layout *layout) static inline void nvmem_layout_unregister(struct nvmem_layout *layout) {} -static inline const void * -nvmem_layout_get_match_data(struct nvmem_device *nvmem, - struct nvmem_layout *layout) -{ - return NULL; -} - #endif /* CONFIG_NVMEM */ #if IS_ENABLED(CONFIG_NVMEM) && IS_ENABLED(CONFIG_OF)