Message ID | 20240204-bus_cleanup-gpio-v1-1-82d91b4ee1de@marliere.net |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-51785-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp430119dyb; Sun, 4 Feb 2024 08:29:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IEbv2DLoNVpcCZ+g+ekv/yuVigpSJKRm5q/N3VFyNb80JKPIQTNxg8+Y76uYGOLjU7FnSf5 X-Received: by 2002:a05:622a:2d6:b0:42c:a4e:e266 with SMTP id a22-20020a05622a02d600b0042c0a4ee266mr5302747qtx.21.1707064174970; Sun, 04 Feb 2024 08:29:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707064174; cv=pass; d=google.com; s=arc-20160816; b=wdIUn1NoAYNuic1g9YkGiKbsYpZ5apxOFmFI86FnciCqq45aSf1rSO4mLxVE7lDVVr LJUs86RP8CRHAe25TwXvqAfGRgK0C72wG1h3IompFrvgeW8i6zytquF588OjunCRp00F 6hZ2LULcrNInCdEonayhGgBXUhZ4PN4vwAWxYjp5d3LiNDn7Udc3c+VQ6cjcx/HiWSl0 ebsxcqXTpV4GgyIjDa/uRt+i6AandCvhX8VuWamFWmRZ6iDiSdtpqsSCdygdC6HS4/FM iqBXAOrVQeil2gNwlh9cljMgjNBJMiX2Yfhu7dN2fuNr8IFboI2qxiQGiGhszfZwNMOX 9j8w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:message-id:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:subject:date :dkim-signature:from; bh=wkEWH6gvNpDijd7cA4NPnUTuDEXBhNQ1QH3JdnlFRIg=; fh=jmdO6OnUvmWAxeBDyCrlMoHQjx5ICqVxoFVoTB4+6+Q=; b=0GkVD0rL1jmxkHLI1EXHa2MVg/0vne3UQX0eVYCpwAmLkmjNC7cSAN4Ljn6Ta7e9+a zD/any9ZrPxO4Y6ZxlVzCTkzHYHGhagkrcNSaO0CT1icx7cl7h7Ze2OKoklIcCen1xOM w5CpQZvrHogm8QSaGhIKK6w+Em8QnvFljqzkcEQSUkd4WdMzv4sUESai5qn6m08QZ966 d0sVNP2utAy7ZcKGNBjC95fnuN8OssM9zPWkjS6c8LjomTtUQro6duyAX5/OlLj+9Vwg ewCGgfKd4uUz+eAjf7JY/n8eJnxwSsZf2A4EPKmu0P9AFigfwISffhcFUxSyCuz1vBx6 R47Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=temperror (no key for signature) header.i=@marliere.net header.s=2023 header.b=oQtL5POX; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-51785-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51785-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCW5KFONaNs+DKbZ+gzSAyQ3cWqz4zJF+ZkT2Bu0qcr84eKZRUCrU/TTmHDr8CcJpG3v9CoZdXcKvatTG7C9WfyhQUgWjw== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id q22-20020a05622a031600b0042c26567e8dsi195237qtw.233.2024.02.04.08.29.34 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Feb 2024 08:29:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51785-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=temperror (no key for signature) header.i=@marliere.net header.s=2023 header.b=oQtL5POX; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-51785-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51785-ouuuleilei=gmail.com@vger.kernel.org" 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id BD8441C21EC4 for <ouuuleilei@gmail.com>; Sun, 4 Feb 2024 16:29:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A73CE2375F; Sun, 4 Feb 2024 16:29:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=marliere.net header.i=@marliere.net header.b="oQtL5POX" Received: from mail-oo1-f45.google.com (mail-oo1-f45.google.com [209.85.161.45]) (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 42A7322EEA; Sun, 4 Feb 2024 16:29:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707064157; cv=none; b=fUzBqZptbxUVwLfcepCkk+cg3ZkHPh1nsQbj8H/QlL3NrsABBqYUS8BaYmEYxio0gNgPvvsvo0wzHYWIbUpLupaFQVEr9i6fkVFP/u7ei362GGZE5lpuT9ggw7zfTy1kadH0olIwX0daB/8x2T4yeLN2dTZT4bM+bJU87rcOekw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707064157; c=relaxed/simple; bh=7Aa3vHYQq1Cas6qCMgssrF4OfAvkTLYL4PbhRMnJOpM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=q0lPojIYvnQIQ1WZJADxOKIkDf95OzyMr91Szye5xwKVIxUis7HEn0P2AlIXMraBDRN4w2pUaalU9WmJ6jWF97+ITPQykLkQpAyRtlsez7IQrDg5Mgm1i65vFPaOBLiZOUtAGinZYZX9YWGc6AFB3sYGTYwKQSgDqmzuOjaN2ac= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=marliere.net; spf=pass smtp.mailfrom=gmail.com; dkim=fail (0-bit key) header.d=marliere.net header.i=@marliere.net header.b=oQtL5POX reason="key not found in DNS"; arc=none smtp.client-ip=209.85.161.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=marliere.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oo1-f45.google.com with SMTP id 006d021491bc7-595aa5b1fe0so2523402eaf.2; Sun, 04 Feb 2024 08:29:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707064154; x=1707668954; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:dkim-signature:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=wkEWH6gvNpDijd7cA4NPnUTuDEXBhNQ1QH3JdnlFRIg=; b=RLnPwXRTyxpB3TaONGBZtZvZJ6OC/FKf4QuO+PEw9SNJE3zvQnHnmS1nfcX2OOsi2U 02bBvmhTf/b0XGpViPYwUPAwVm2MNmTJvO28gGOhGZTO5vJ2zzTMF59NMkpPufyfaH93 ENS/+BzG2BT9XzPANLznFISHAcRSOPHHa0bqES2uafDHJfsBEvezKiuo4gZh3myDpRkB GHXW4DM3ey8PH9T3KXzyXp/ukz91dmLX+IFdCpbmJNx/K68jKTNlGtDBnAS+Um07wA0k gwix75JfD4RKnMTIZkjs0qOocv5083+SwQ20dZc9QJnmMzql2Jos5w9ldLVLpAOQxkd6 jYPQ== X-Gm-Message-State: AOJu0YwgR84dM79QKjmQgVeU9rM2nG6L2YUSej8lGEwcMvELT2wZ+lLJ CKodDuEH7L+p83z/ISBfPXRoVyoTWJWhKRYmMJ7WZfkR2ZvML3lTVj3beciHsOi22Q== X-Received: by 2002:a05:6358:7e13:b0:178:778a:30e1 with SMTP id o19-20020a0563587e1300b00178778a30e1mr16107803rwm.11.1707064154123; Sun, 04 Feb 2024 08:29:14 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCUrYVc2ig8vzFUVeWoc6V4P/bVaX7DS/UP63Ko5rlj/MrCPLREYUbp7wugUcViWySfIxUIOU8aPGdyrRji8q8Gt9SxNfvntKg4i2PsWz1hsPJeo0Ixl1l4/QoB+Ub3Jo5glUXI+OwXSAYlx6rbWpvQUBMqkGBlmUA== Received: from mail.marliere.net ([24.199.118.162]) by smtp.gmail.com with ESMTPSA id g3-20020aa79dc3000000b006e02eb7fb05sm2359374pfq.160.2024.02.04.08.29.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Feb 2024 08:29:13 -0800 (PST) From: "Ricardo B. Marliere" <ricardo@marliere.net> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marliere.net; s=2023; t=1707064151; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wkEWH6gvNpDijd7cA4NPnUTuDEXBhNQ1QH3JdnlFRIg=; b=oQtL5POX6P4wsS9sk+vECFOCc1zVsFHanQzNpYbPLrASGnrcid4tCmdexHx2sYu5I924Kf +rqLpOvdq0jTqEKIUByuHHwE7uA3MoTnIEYIF18mR4R0xNkcUbLqqVZw6ObQfxO14GENQm gBr3CY2pnhuz2NBvdD0ENQOAfxO65o7sYii3IAfUW4fmAoP563gNjPxcZdFApGosp926aT z4GIQMLaBicp0jBXjTVeLYgKPFt3OI4c8Sx6KV+fv+rugGhfBIwC7B1ZNG51q6GQ31i+tS XFfkU+lSi4fjNSQVv3b1P/ectK7hoB/V9cfrWtr0wdBBgKG+GAk8WkkqNRpKvw== Authentication-Results: ORIGINATING; auth=pass smtp.auth=ricardo@marliere.net smtp.mailfrom=ricardo@marliere.net Date: Sun, 04 Feb 2024 13:29:42 -0300 Subject: [PATCH] gpio: gpiolib: make gpio_bus_type const Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240204-bus_cleanup-gpio-v1-1-82d91b4ee1de@marliere.net> X-B4-Tracking: v=1; b=H4sIAHW7v2UC/x3MQQqAIBBA0avErBPMjKKrRMRUkw2EimIE0t2Tl m/xf4ZIgSnCWGUIdHNkZwuauoLtRGtI8F4MSiotldRiTXHZLkKbvDCeneh6Ihz2VmGHUDIf6OD nX07z+34nU20CYgAAAA== To: Linus Walleij <linus.walleij@linaro.org>, Bartosz Golaszewski <brgl@bgdev.pl> Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, "Ricardo B. Marliere" <ricardo@marliere.net> X-Developer-Signature: v=1; a=openpgp-sha256; l=1075; i=ricardo@marliere.net; h=from:subject:message-id; bh=7Aa3vHYQq1Cas6qCMgssrF4OfAvkTLYL4PbhRMnJOpM=; b=owEBbQKS/ZANAwAKAckLinxjhlimAcsmYgBlv7t262tpxtjoDfiGTQJSHx4/rnZhb6DFY3+It uP1aECE3ZeJAjMEAAEKAB0WIQQDCo6eQk7jwGVXh+HJC4p8Y4ZYpgUCZb+7dgAKCRDJC4p8Y4ZY pkf2D/9SUPLxQHC4Wa76gTRLTGHSDdWvDnfklXGa3QPBrZwKCUooTXmdeAmFsB5IVTMvYWwEFtm VqEp94xV2R3yDrXaChSnrTtO5UkWGRxI2DGHLpt2+wM3bbDegPWHso2hArkbK1xyIok0FVEil8G 7VvhQf9Yoeom7etDEW4QPbUEJ41W9gUPs0clWRVWrpBl5iAcDqd4DrXNaEWG9MCA2GhxjXu7imk LKe2xxRuPsWjxIECqfNoctz8n9PIH9iGhv5YKbXDelUaWJ3GMa449RqGWxsm1Knjb+XoZxNts40 14X3WDae1Jy0qGqHii5GAdG/x2C7QqOuXQaCW59Tdobv7u8oY8PzDVQa+GDk8PIVmpdqC6KJPHl vGNX7RmPqdP3mRSq5mg0c+HGiCNYLcls7/mipdFp59NKIuqUxuJaSztMfKXyR7q9tcaJXEhtmPL Ae4ctUQ37QK6smHQGYqyiR1kSuQabtBwGLaYTmi4p3nm5HEucCa7381BL4ZdpHpqEPQs68lpZV6 9iXV+JqnRhX4K96g5N3p3jWzmMXfPBSDz79pc1+K1Czswfej+oBYK04Aw7rnJBaDOn/bWuT38U+ W9b1LWnXOrcqGPzS7mw5L5xgzvvRP5J8YTEFYjS9K0o+88ZSifj6n+ESy/i+tSbjAr4JfpCZqVt /6xNfXm02LIcQvg== X-Developer-Key: i=ricardo@marliere.net; a=openpgp; fpr=030A8E9E424EE3C0655787E1C90B8A7C638658A6 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789986524132032424 X-GMAIL-MSGID: 1789986524132032424 |
Series |
gpio: gpiolib: make gpio_bus_type const
|
|
Commit Message
Ricardo B. Marliere
Feb. 4, 2024, 4:29 p.m. UTC
Now that the driver core can properly handle constant struct bus_type,
move the gpio_bus_type variable to be a constant structure as well,
placing it into read-only memory which can not be modified at runtime.
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
---
drivers/gpio/gpiolib.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
base-commit: 3eac8bbed22e940ac1645a884f221bef408f675c
change-id: 20240204-bus_cleanup-gpio-57eea8d32a5a
Best regards,
Comments
On Sun, Feb 04, 2024 at 07:34:43PM +0100, Bartosz Golaszewski wrote: > On Sun, Feb 4, 2024 at 5:29 PM Ricardo B. Marliere <ricardo@marliere.net> wrote: > > > > Now that the driver core can properly handle constant struct bus_type, > > move the gpio_bus_type variable to be a constant structure as well, > > placing it into read-only memory which can not be modified at runtime. > > > > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > > Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > > Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net> > > --- > > drivers/gpio/gpiolib.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c > > index d50a786f8176..24d046268a01 100644 > > --- a/drivers/gpio/gpiolib.c > > +++ b/drivers/gpio/gpiolib.c > > @@ -63,7 +63,7 @@ static int gpio_bus_match(struct device *dev, struct device_driver *drv) > > return 1; > > } > > > > -static struct bus_type gpio_bus_type = { > > +static const struct bus_type gpio_bus_type = { > > .name = "gpio", > > .match = gpio_bus_match, > > }; > > > > --- > > base-commit: 3eac8bbed22e940ac1645a884f221bef408f675c > > change-id: 20240204-bus_cleanup-gpio-57eea8d32a5a > > > > Best regards, > > -- > > Ricardo B. Marliere <ricardo@marliere.net> > > > > Ha! Does the same work now for struct device_type? Very much so, please feel free to do so, that's next on my list of things to do for the tree. greg k-h
On Sun, Feb 04, 2024 at 01:29:42PM -0300, Ricardo B. Marliere wrote: > Now that the driver core can properly handle constant struct bus_type, > move the gpio_bus_type variable to be a constant structure as well, > placing it into read-only memory which can not be modified at runtime. > > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index d50a786f8176..24d046268a01 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -63,7 +63,7 @@ static int gpio_bus_match(struct device *dev, struct device_driver *drv) return 1; } -static struct bus_type gpio_bus_type = { +static const struct bus_type gpio_bus_type = { .name = "gpio", .match = gpio_bus_match, };