From patchwork Fri Jan 5 10:26:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 185339 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp6134207dyb; Fri, 5 Jan 2024 02:27:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IE+6k2LU7nJQzgjlLs2HTxZNszjY+MeTWRWWRxEJGVmTE+Q3Za0I+Nct4IgSPapsYBUasrQ X-Received: by 2002:a05:6808:10c9:b0:3bc:3046:94b1 with SMTP id s9-20020a05680810c900b003bc304694b1mr2273529ois.99.1704450428964; Fri, 05 Jan 2024 02:27:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704450428; cv=none; d=google.com; s=arc-20160816; b=b92T/0+MtX3SuXpujvRM51VH0wW83fqU4zGFrSEA6eOW8oSeQwuNiieyyzdMtUt9FM 7VCcV1cDT7ezpP1T1wss5V7y7UR2acu2nieerxajPC8DAsf1lVlrTpTs0upEL3Dua83w AQnXKhh8lcUhYqTRtxuvWuLek9K5ymMWUBnQhkFSOrxxi58GVNmMIjivmJ0RcWdMnjVe nvYiTlQ+2+C03t3g4ugI67Vn2622xti0qe/vI/sCqSIqqXrqhf6DYFP6YQYsfDd23X4v qZGxDyABv2xgnEXXFkkH15bLSXUf/aIU72gIg/DCtb1U9mawm2KtVfiyWGRkd1wPE+oK XQjA== 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=8/QFbq4hem4hTNzKvbROe8o43SsEXcNNdcSJ9CH8MVk=; fh=jUXwtF0520eqoQ34ytTRmHhHfmU9hKCLubTc/MmAv2E=; b=Nnu0uYBa0rD7UGmlWyy49z4ezaJqcHFKZ74VTzfuHGRXY8jRqP04ZnX/J+agKg1Tn9 QB9WEVAyH2NxBGxn69Sk72GuxKlaoem0bmOY9UlwLSHUbQW49895y5ZB/OnD0QS7he1V dDK+V/Ch9o4Pc4JB9SkQEnsAR9jQLIW7/HhPSczM0pZdI9EZnSqZPEi5TLKi7uxDbT5Y 78Z74LQtjKOOrt5XV638AnTUIm6wcPwA6j/vs6iyUzjoSZAmh55lDX+x8OyElcQ5WHyG k7/OBUUaAaX0/geOAaqGhpflhco2Jgny32gcy6LU82IYVtbOOAyImcIPVmE+QiyYcZuL fTZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qkKuJGrV; spf=pass (google.com: domain of linux-kernel+bounces-17744-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17744-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id u21-20020aa78395000000b006d0d40fdf7asi1046478pfm.228.2024.01.05.02.27.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 02:27:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-17744-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qkKuJGrV; spf=pass (google.com: domain of linux-kernel+bounces-17744-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17744-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 7FB2B2845B1 for ; Fri, 5 Jan 2024 10:27:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A1FBE286B5; Fri, 5 Jan 2024 10:26:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="qkKuJGrV" 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 0A271250E9 for ; Fri, 5 Jan 2024 10:26:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D854C433C8; Fri, 5 Jan 2024 10:26:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1704450414; bh=In4idDpSGy2rHfbF3CvZPnLiRDq4Xmq3P7L4d+F3SbY=; h=From:To:Cc:Subject:Date:From; b=qkKuJGrV4z7gBf+9dGxHPFRAnYA8qo8Vtg3prb4nyJOCxDP7Yd+r4qsmFscZsCIdp K/29k+AQEDP7+XHHKoxxjTWTQvK7wF6d6H7dEfbO3r92QVYYmiO2/bk8mylTxR01IN oEFlUh3RY1EBKrrq3mwC40ykZ7BwlF43erYsghnI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" Subject: [PATCH] driver core: cpu: make cpu_subsys const Date: Fri, 5 Jan 2024 11:26:48 +0100 Message-ID: <2024010548-crane-snooze-a871@gregkh> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Lines: 39 X-Developer-Signature: v=1; a=openpgp-sha256; l=1286; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=In4idDpSGy2rHfbF3CvZPnLiRDq4Xmq3P7L4d+F3SbY=; b=owGbwMvMwCRo6H6F97bub03G02pJDKnTb2Zc+vmgslCotcptksdygdOd1h6M3z7yJP1cIp1vX 3yoSVCsI5aFQZCJQVZMkeXLNp6j+ysOKXoZ2p6GmcPKBDKEgYtTACbSd4FhfnnmQudLG+dtq49I Tg0r3zlL5sb2ZobZLFzWHpVvOWbtfuRSW70zs9Dq6EJ7AA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787245812726733029 X-GMAIL-MSGID: 1787245812726733029 Now that the driver core can properly handle constant struct bus_type, move the cpu_subsys variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime. Cc: "Rafael J. Wysocki" Signed-off-by: Greg Kroah-Hartman --- drivers/base/cpu.c | 2 +- include/linux/cpu.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 82b6a76125f5..c3c15adb7da9 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c @@ -366,7 +366,7 @@ static int cpu_uevent(const struct device *dev, struct kobj_uevent_env *env) } #endif -struct bus_type cpu_subsys = { +const struct bus_type cpu_subsys = { .name = "cpu", .dev_name = "cpu", .match = cpu_subsys_match, diff --git a/include/linux/cpu.h b/include/linux/cpu.h index dcb89c987164..0b993a140946 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h @@ -128,7 +128,7 @@ static inline void cpu_maps_update_done(void) static inline int add_cpu(unsigned int cpu) { return 0;} #endif /* CONFIG_SMP */ -extern struct bus_type cpu_subsys; +extern const struct bus_type cpu_subsys; extern int lockdep_is_cpus_held(void);