Message ID | 2023121957-tapered-upswing-8326@gregkh |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-5663-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2092523dyi; Tue, 19 Dec 2023 09:19:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IEdMU2FZM9p+ao1KSP6849YVMdDUbUS3w8ATdLaT3xjnp/4IIYXYRIEtX0cvQW9Sg4zFVP5 X-Received: by 2002:a05:620a:1daa:b0:77f:7898:8a86 with SMTP id pj42-20020a05620a1daa00b0077f78988a86mr11567085qkn.50.1703006360719; Tue, 19 Dec 2023 09:19:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703006360; cv=none; d=google.com; s=arc-20160816; b=tCTgYHCNhaPDQUZZULcpZDCioUMx2jShZibOiTixZr7LjH5vdOWg6CqPAXxI09YWzq ykSoB3qp7T05rk7g1xlKOP1zEXOlbKOAQJqVU68I7N2KiQp8el3bFWJn+gHPxPlsAUCl V9tFVcqELoi44w0xvFaqiev9Qp7quiPtUzZjN+PBO9qARwM5azQdP74gDoMJc/cJeWHo htBZ+hMGCCAkzXZHooUM0+uaM+0UVABpsMVvxPx3du6o/jZDvUsxmIY1R1xD8ucIjiYF z/Jxys7IFkq4GiiWSTXSTc8s4xR4QaudNc2PO4tn2bXlaHCjgCbqy3u2+ex8Hl+BchxC cE2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:lines:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=xMRIvqxqHeVWrXRHi7COkRJbYASzDygPMwnMMvXeu+k=; fh=HLXH8Mq+Cxx6YN+FfSfP3MMe8k9iEqn+CFdUuQlMk88=; b=w60oddJlDyea46HWfIhTVgu5opnxd5osYZvVNzChUCbG/eemx9qHIk5UJIOiBYmWIf oxC8/ABURY8BO6kjUrNSW7patYk2uzs5ZDUy7ybRqRvbm/UwXujnABWzNuX/krbLNZsw 1k69RT5CtRDNvkcjxn6UhuHRsGKxDlMGfqqXM5vHjkcTmzG1nqyw40WUhVCsVCuo7y1G HxVV2BDa8sW5j3DhA9eBcMh9U4GE5992n/q7Oqi4klSSYyKvhUFHpjWlZ5uVdpXXeFej tE2c1RqRiWl1M5X/WU4FwaE1u2WbxPutETf4+CFbFGUr4l/39tlCwJmAEk8b1SSJAnIu SX3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gEDyh+3q; spf=pass (google.com: domain of linux-kernel+bounces-5663-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5663-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id h4-20020a05620a284400b0076f280e295fsi27223505qkp.429.2023.12.19.09.19.20 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 09:19:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5663-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gEDyh+3q; spf=pass (google.com: domain of linux-kernel+bounces-5663-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5663-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.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 7D7441C24F13 for <ouuuleilei@gmail.com>; Tue, 19 Dec 2023 17:19:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4B4EF2DF84; Tue, 19 Dec 2023 17:19:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="gEDyh+3q" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 41F6B31A6E; Tue, 19 Dec 2023 17:19:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66050C433C7; Tue, 19 Dec 2023 17:19:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1703006343; bh=oFlModBgHHrw6mw7QX5fJ8iZecR+dIhjZKfdEJupX78=; h=From:To:Cc:Subject:Date:From; b=gEDyh+3qajbt33sxBJRuS2q7Vhi3i6cm4LFQNegsV7joyO44Ap+b5HdAi/NfVWR3T 8knT3xYXfKO0e6RMQYOP3Y3lFw/outxaVb30lV21E3IJrqYqxmFjn3k0vwoS96Qp3W dfnXihFT7lBnkSwsbZRDpFHsB68oU0dFfVOa9zLM= From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> To: hdegoede@redhat.com Cc: linux-kernel@vger.kernel.org, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Maximilian Luz <luzmaximilian@gmail.com>, =?utf-8?q?Ilpo_J=C3=A4rvinen?= <ilpo.jarvinen@linux.intel.com>, platform-driver-x86@vger.kernel.org Subject: [PATCH] platform/surface: aggregator: make ssam_bus_type constant and static Date: Tue, 19 Dec 2023 18:18:58 +0100 Message-ID: <2023121957-tapered-upswing-8326@gregkh> X-Mailer: git-send-email 2.43.0 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 Lines: 60 X-Developer-Signature: v=1; a=openpgp-sha256; l=2207; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=oFlModBgHHrw6mw7QX5fJ8iZecR+dIhjZKfdEJupX78=; b=owGbwMvMwCRo6H6F97bub03G02pJDKmNF5oY5n3gUVu26WbCT7m3t/ezzFvW4HbCtVHVvdwv9 /SkzUfKO2JZGASZGGTFFFm+bOM5ur/ikKKXoe1pmDmsTGBDuDgFYCJ1sgzzVJZ9XHxYLK7Ui+WB d1N1Z8Cr9UxvGRbMZF0dFpV5NX1pi21Ban+XTZrLcn0A X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785731597848549622 X-GMAIL-MSGID: 1785731597848549622 |
Series |
platform/surface: aggregator: make ssam_bus_type constant and static
|
|
Commit Message
Greg KH
Dec. 19, 2023, 5:18 p.m. UTC
Now that the driver core can properly handle constant struct bus_type,
move the ssam_bus_type variable to be a constant structure as well,
placing it into read-only memory which can not be modified at runtime.
It's also never used outside of
drivers/platform/surface/aggregator/bus.c so make it static and don't
export it as no one is using it.
Cc: Maximilian Luz <luzmaximilian@gmail.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: platform-driver-x86@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/platform/surface/aggregator/bus.c | 5 +++--
include/linux/surface_aggregator/device.h | 1 -
2 files changed, 3 insertions(+), 3 deletions(-)
Comments
On 12/19/23 18:18, Greg Kroah-Hartman wrote: > Now that the driver core can properly handle constant struct bus_type, > move the ssam_bus_type variable to be a constant structure as well, > placing it into read-only memory which can not be modified at runtime. > > It's also never used outside of > drivers/platform/surface/aggregator/bus.c so make it static and don't > export it as no one is using it. Thanks! Looks good to me. Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com> > Cc: Maximilian Luz <luzmaximilian@gmail.com> > Cc: Hans de Goede <hdegoede@redhat.com> > Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com> > Cc: platform-driver-x86@vger.kernel.org > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > --- > drivers/platform/surface/aggregator/bus.c | 5 +++-- > include/linux/surface_aggregator/device.h | 1 - > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/platform/surface/aggregator/bus.c b/drivers/platform/surface/aggregator/bus.c > index 42ccd7f1c9b9..118caa651bec 100644 > --- a/drivers/platform/surface/aggregator/bus.c > +++ b/drivers/platform/surface/aggregator/bus.c > @@ -35,6 +35,8 @@ static struct attribute *ssam_device_attrs[] = { > }; > ATTRIBUTE_GROUPS(ssam_device); > > +static const struct bus_type ssam_bus_type; > + > static int ssam_device_uevent(const struct device *dev, struct kobj_uevent_env *env) > { > const struct ssam_device *sdev = to_ssam_device(dev); > @@ -329,13 +331,12 @@ static void ssam_bus_remove(struct device *dev) > sdrv->remove(to_ssam_device(dev)); > } > > -struct bus_type ssam_bus_type = { > +static const struct bus_type ssam_bus_type = { > .name = "surface_aggregator", > .match = ssam_bus_match, > .probe = ssam_bus_probe, > .remove = ssam_bus_remove, > }; > -EXPORT_SYMBOL_GPL(ssam_bus_type); > > /** > * __ssam_device_driver_register() - Register a SSAM client device driver. > diff --git a/include/linux/surface_aggregator/device.h b/include/linux/surface_aggregator/device.h > index 42b249b4c24b..8cd8c38cf3f3 100644 > --- a/include/linux/surface_aggregator/device.h > +++ b/include/linux/surface_aggregator/device.h > @@ -193,7 +193,6 @@ struct ssam_device_driver { > > #ifdef CONFIG_SURFACE_AGGREGATOR_BUS > > -extern struct bus_type ssam_bus_type; > extern const struct device_type ssam_device_type; > > /**
Hi Greg, On 12/19/23 18:18, Greg Kroah-Hartman wrote: > Now that the driver core can properly handle constant struct bus_type, > move the ssam_bus_type variable to be a constant structure as well, > placing it into read-only memory which can not be modified at runtime. > > It's also never used outside of > drivers/platform/surface/aggregator/bus.c so make it static and don't > export it as no one is using it. > > Cc: Maximilian Luz <luzmaximilian@gmail.com> > Cc: Hans de Goede <hdegoede@redhat.com> > Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com> > Cc: platform-driver-x86@vger.kernel.org > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Greg, do you plan to merge this yourself (fine with me) or do you want me to merge this through pdx86 ? Regards, Hans > --- > drivers/platform/surface/aggregator/bus.c | 5 +++-- > include/linux/surface_aggregator/device.h | 1 - > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/platform/surface/aggregator/bus.c b/drivers/platform/surface/aggregator/bus.c > index 42ccd7f1c9b9..118caa651bec 100644 > --- a/drivers/platform/surface/aggregator/bus.c > +++ b/drivers/platform/surface/aggregator/bus.c > @@ -35,6 +35,8 @@ static struct attribute *ssam_device_attrs[] = { > }; > ATTRIBUTE_GROUPS(ssam_device); > > +static const struct bus_type ssam_bus_type; > + > static int ssam_device_uevent(const struct device *dev, struct kobj_uevent_env *env) > { > const struct ssam_device *sdev = to_ssam_device(dev); > @@ -329,13 +331,12 @@ static void ssam_bus_remove(struct device *dev) > sdrv->remove(to_ssam_device(dev)); > } > > -struct bus_type ssam_bus_type = { > +static const struct bus_type ssam_bus_type = { > .name = "surface_aggregator", > .match = ssam_bus_match, > .probe = ssam_bus_probe, > .remove = ssam_bus_remove, > }; > -EXPORT_SYMBOL_GPL(ssam_bus_type); > > /** > * __ssam_device_driver_register() - Register a SSAM client device driver. > diff --git a/include/linux/surface_aggregator/device.h b/include/linux/surface_aggregator/device.h > index 42b249b4c24b..8cd8c38cf3f3 100644 > --- a/include/linux/surface_aggregator/device.h > +++ b/include/linux/surface_aggregator/device.h > @@ -193,7 +193,6 @@ struct ssam_device_driver { > > #ifdef CONFIG_SURFACE_AGGREGATOR_BUS > > -extern struct bus_type ssam_bus_type; > extern const struct device_type ssam_device_type; > > /**
On Thu, Dec 21, 2023 at 02:03:03PM +0100, Hans de Goede wrote: > Hi Greg, > > On 12/19/23 18:18, Greg Kroah-Hartman wrote: > > Now that the driver core can properly handle constant struct bus_type, > > move the ssam_bus_type variable to be a constant structure as well, > > placing it into read-only memory which can not be modified at runtime. > > > > It's also never used outside of > > drivers/platform/surface/aggregator/bus.c so make it static and don't > > export it as no one is using it. > > > > Cc: Maximilian Luz <luzmaximilian@gmail.com> > > Cc: Hans de Goede <hdegoede@redhat.com> > > Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com> > > Cc: platform-driver-x86@vger.kernel.org > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > > Greg, do you plan to merge this yourself (fine with me) > or do you want me to merge this through pdx86 ? I can merge it, thanks! greg k-h
diff --git a/drivers/platform/surface/aggregator/bus.c b/drivers/platform/surface/aggregator/bus.c index 42ccd7f1c9b9..118caa651bec 100644 --- a/drivers/platform/surface/aggregator/bus.c +++ b/drivers/platform/surface/aggregator/bus.c @@ -35,6 +35,8 @@ static struct attribute *ssam_device_attrs[] = { }; ATTRIBUTE_GROUPS(ssam_device); +static const struct bus_type ssam_bus_type; + static int ssam_device_uevent(const struct device *dev, struct kobj_uevent_env *env) { const struct ssam_device *sdev = to_ssam_device(dev); @@ -329,13 +331,12 @@ static void ssam_bus_remove(struct device *dev) sdrv->remove(to_ssam_device(dev)); } -struct bus_type ssam_bus_type = { +static const struct bus_type ssam_bus_type = { .name = "surface_aggregator", .match = ssam_bus_match, .probe = ssam_bus_probe, .remove = ssam_bus_remove, }; -EXPORT_SYMBOL_GPL(ssam_bus_type); /** * __ssam_device_driver_register() - Register a SSAM client device driver. diff --git a/include/linux/surface_aggregator/device.h b/include/linux/surface_aggregator/device.h index 42b249b4c24b..8cd8c38cf3f3 100644 --- a/include/linux/surface_aggregator/device.h +++ b/include/linux/surface_aggregator/device.h @@ -193,7 +193,6 @@ struct ssam_device_driver { #ifdef CONFIG_SURFACE_AGGREGATOR_BUS -extern struct bus_type ssam_bus_type; extern const struct device_type ssam_device_type; /**