From patchwork Sat Mar 2 17:05:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ricardo B. Marliere" X-Patchwork-Id: 13579575 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-io1-f49.google.com (mail-io1-f49.google.com [209.85.166.49]) (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 8A98D2375F; Sat, 2 Mar 2024 17:06:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709399172; cv=none; b=ovkzdZGh/0nH3Rks8Cy7Bl6LS23zWbEkW+XbR7FAN98Fvn5aIyUAGAKV4r1pFZLdFKG/VqQfhofOOBIHAuuea9IAUJIMShYR8J7xvm+BmoSQKyQaEk53cDoDo9M2SauM+SV0vegC0Dz3r+knwuayEPumFxV82dKSmINvmNCdHXM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709399172; c=relaxed/simple; bh=DVLONE6hA6DnIW62nPfbQNEd9ruSxfvRSwzoof3s5nI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=m3XmelJuWWTmRQtdC1q23BBWNf0um7b32PZ0j2i0M9rBcIN38r0fTVbTvP7deuq9SIKiuUpppNBEM/riwBKliKvmYa2Zi8NcfVhfd2Ne7re0GwNCo2riiwFWRhDfKqC81PxcUEHn+p2Pl5pMpEtjvW3xh0dlbHXWfe27pJYWqXA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=marliere.net; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=marliere.net header.i=@marliere.net header.b=YHcImU44; arc=none smtp.client-ip=209.85.166.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=marliere.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marliere.net header.i=@marliere.net header.b="YHcImU44" Received: by mail-io1-f49.google.com with SMTP id ca18e2360f4ac-7c403dbf3adso206984939f.1; Sat, 02 Mar 2024 09:06:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709399169; x=1710003969; h=cc:to:in-reply-to:references: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=KJqgoH62LO9fENR8x+qZ3sa/FE1S2fO1vPl+clynvjc=; b=lVJYIUtglLrEjJuff/gupvlOyRi7GVc1SbPR0qBn9tC64OLoYQUVYfPZUGMfHDAiU3 WKRC2A1Vj44J0BE8c01hSLpao5Xx/20XDCShYPfT3swjU1QJanrXN9RE/VgcQDEE6XH6 Sc2L30/k6iizBkf8JsVhFPQ4DcWcLgFL/L4AyjIi9WtHp8zxqmMi/TqhyhVQrXmUomXC WFavj8C65bdb1CQ0unUL7oL6xxO2FNcPAdxNuhd6XnKBPIjnAlDk50mTd2OHERSNkbcm PPToXpKYYl6cQPjtvheI0yPrHPd2bDXoMHm2njy6GpuiEkhoZwSbM4e2pSOnaPtki5kj Z60A== X-Forwarded-Encrypted: i=1; AJvYcCVnld7VSG2r+tzFkCZC0j/5OuXzOgDfiguxeuv8Q2mcLvwRJIJ7i6Zaw5Bu0KrBlg+ICthHDWpBaf9ezBd+L7uUxQM63W//7l+tYf1Oeq0eSGS8f6QkA2lcvVUFGS8W7QQ+PgmfJERjdKk9wE42Ode4dBw7gdycbISAWeuauh8x X-Gm-Message-State: AOJu0Yy7+ujv/BQOs+f0xhZ4Q7e3e0424XZfkeoVcF20RxlajdJ2XGLx k1N+3uF0i6/IhjZ35Y3kg55/CKmjrXNkfARJGtrPhGaNucaBb3QTz4Q/ZuRnYSDRhw== X-Google-Smtp-Source: AGHT+IH05YwYl9Yb4xTua5+7CLgKehkQOZJUrg7FqFHW10gD1MBHPLvPZ1868UGnmmPXZYFrmmei0g== X-Received: by 2002:a05:6e02:17cc:b0:365:2429:f60b with SMTP id z12-20020a056e0217cc00b003652429f60bmr5337904ilu.18.1709399169632; Sat, 02 Mar 2024 09:06:09 -0800 (PST) Received: from mail.marliere.net ([24.199.118.162]) by smtp.gmail.com with ESMTPSA id a17-20020a92d591000000b00364ec1f92d9sm1577307iln.9.2024.03.02.09.06.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Mar 2024 09:06:09 -0800 (PST) From: "Ricardo B. Marliere" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marliere.net; s=2024; t=1709399168; 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: in-reply-to:in-reply-to:references:references; bh=KJqgoH62LO9fENR8x+qZ3sa/FE1S2fO1vPl+clynvjc=; b=YHcImU44wKwbvQ37GYFwG+SAA6m9VXEFIHFmaYur0rZ01XkO8uEgbOAZhiHVoaLQ3u75vz Xg0f5Lh0iuxB/xO/2UIAEWbX8qbhWsEZnK4LPtBurKUPYfb8semDPAb53lEzhVMM8pidig R4LHUH0GWolXhOhDd3bnHWi6g3kRNds3n2kleqkzI4K11L0Ebm3WKFmm6NS/R7uaN9NwGp aT0lvAMGfkCKtAy5oCGfW9HHn5ZweMzjVPMPcWNoWrxeiCqjBpVXH1gzeEsP+lUKciFg0+ /b1XmuiEZs7QFfPRyoLYCXlD8rR7PvSdawlAMLjHmRQuwiHYZv0O6xlI3lWGkA== Authentication-Results: ORIGINATING; auth=pass smtp.auth=ricardo@marliere.net smtp.mailfrom=ricardo@marliere.net Date: Sat, 02 Mar 2024 14:05:57 -0300 Subject: [PATCH net-next 1/6] net: hns: make hnae_class constant Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240302-class_cleanup-net-next-v1-1-8fa378595b93@marliere.net> References: <20240302-class_cleanup-net-next-v1-0-8fa378595b93@marliere.net> In-Reply-To: <20240302-class_cleanup-net-next-v1-0-8fa378595b93@marliere.net> To: Yisen Zhuang , Salil Mehta , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Loic Poulain , Sergey Ryazanov , Johannes Berg , Krzysztof Kozlowski Cc: Greg Kroah-Hartman , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-ppp@vger.kernel.org, "Ricardo B. Marliere" X-Developer-Signature: v=1; a=openpgp-sha256; l=2248; i=ricardo@marliere.net; h=from:subject:message-id; bh=DVLONE6hA6DnIW62nPfbQNEd9ruSxfvRSwzoof3s5nI=; b=owEBbQKS/ZANAwAKAckLinxjhlimAcsmYgBl41x6b+s4rceZcISXI4+wCrkuYovsuJqLCzXIG gk0MhwCfTmJAjMEAAEKAB0WIQQDCo6eQk7jwGVXh+HJC4p8Y4ZYpgUCZeNcegAKCRDJC4p8Y4ZY pvLmD/4s9bqOGoGTH1ZUlZ3OwPrCqI5ELU0SagHcoxN2mHZOgQ6GJny+ldo2RjwMDLvaXS/vg6X zKf5qJ24QFb1o/KUdm1Sxn1NqdZzLlC4Hz4znlROmPsW/4rfr8LipsuvQILak7xPHNkm9+cYuB2 /C7fU3OxReAbarm6Av7+U8bN3Dlboz7AGsA8cvyOkin0SAcgKbvXiqzIncIDvV41yaIJKFkXPu0 7gYIkE13M2VzSjQbkRpykunJaCgj+HlZWmYTimMK4snuu1EpURf38FxZXDQI0uyoLEIQA2fkgeC F2XsQgpQfYeFvrK7XI1IbW2uhlUydaUFmhtrQJ0456ExH5eU1TxCTjt9y3sXuxVlVoGAF07wOR7 6PIW3EOWXhl29qbkVXqjdtEB/Lw8XEotMEPOPd2yvrgAlwG9QU950mgFCJwogwgGFoTYp0DSUKS ZINVjWiwogd4PQ7rmNOTuI07BL/roxByZTCDWR6iDb7fUWMrvF0f6pB6LbRBASHDhMIxncb1jWQ UqBnzfqZ4dz67oYZcsnHYJgygppvbDXIgevqWhCjToN30xnqSE+uw6LIDZ7C9cStb1FJtybzaSR SORq+JL+xH942ASjwZ9bIPublxiJc7F2vveq8dfdsezY2ci/urjJMosgBfR9pZThBvvBeZlT7yX hRSLowMknijbH9w== X-Developer-Key: i=ricardo@marliere.net; a=openpgp; fpr=030A8E9E424EE3C0655787E1C90B8A7C638658A6 X-Patchwork-Delegate: kuba@kernel.org Since commit 43a7206b0963 ("driver core: class: make class_register() take a const *"), the driver core allows for struct class to be in read-only memory, so move the hnae_class structure to be declared at build time placing it into read-only memory, instead of having to be dynamically allocated at boot time. Cc: Greg Kroah-Hartman Suggested-by: Greg Kroah-Hartman Signed-off-by: Ricardo B. Marliere Reviewed-by: Simon Horman --- drivers/net/ethernet/hisilicon/hns/hnae.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns/hnae.c b/drivers/net/ethernet/hisilicon/hns/hnae.c index 8a1027ad340d..d4293f76d69d 100644 --- a/drivers/net/ethernet/hisilicon/hns/hnae.c +++ b/drivers/net/ethernet/hisilicon/hns/hnae.c @@ -12,7 +12,9 @@ #define cls_to_ae_dev(dev) container_of(dev, struct hnae_ae_dev, cls_dev) -static struct class *hnae_class; +static const struct class hnae_class = { + .name = "hnae", +}; static void hnae_list_add(spinlock_t *lock, struct list_head *node, struct list_head *head) @@ -111,7 +113,7 @@ static struct hnae_ae_dev *find_ae(const struct fwnode_handle *fwnode) WARN_ON(!fwnode); - dev = class_find_device(hnae_class, NULL, fwnode, __ae_match); + dev = class_find_device(&hnae_class, NULL, fwnode, __ae_match); return dev ? cls_to_ae_dev(dev) : NULL; } @@ -415,7 +417,7 @@ int hnae_ae_register(struct hnae_ae_dev *hdev, struct module *owner) hdev->owner = owner; hdev->id = (int)atomic_inc_return(&id); hdev->cls_dev.parent = hdev->dev; - hdev->cls_dev.class = hnae_class; + hdev->cls_dev.class = &hnae_class; hdev->cls_dev.release = hnae_release; (void)dev_set_name(&hdev->cls_dev, "hnae%d", hdev->id); ret = device_register(&hdev->cls_dev); @@ -448,13 +450,12 @@ EXPORT_SYMBOL(hnae_ae_unregister); static int __init hnae_init(void) { - hnae_class = class_create("hnae"); - return PTR_ERR_OR_ZERO(hnae_class); + return class_register(&hnae_class); } static void __exit hnae_exit(void) { - class_destroy(hnae_class); + class_unregister(&hnae_class); } subsys_initcall(hnae_init); From patchwork Sat Mar 2 17:05:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ricardo B. Marliere" X-Patchwork-Id: 13579576 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-io1-f42.google.com (mail-io1-f42.google.com [209.85.166.42]) (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 C1F9A3611A; Sat, 2 Mar 2024 17:06:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709399175; cv=none; b=dtRvAbHf6AxWy6ModuNAAP5lNpZwvDZ+zQLMyICfa6to0oE8ZNI5DDs/Vv6ooNtOnGOElbDpXs465XbakRlfxuz47vMH7TzHXZAFGKp8E4qv4GAX6d0rW7MbsACn0PIBoih5Pj8Xkz7BQ787Vuw286HbIKyqvUwft+bhpP1/7GA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709399175; c=relaxed/simple; bh=qXay6ldHY4MUDiGqJdsMIllcHV6D4WAZhf81UWPWDoI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=s2OWiTLR38edOOJplfoeAOfTxpTufnL9Tc6fOtrFCdDXAf923ArU75UC4Zndq+h1WaSSm2mwcrZqn9S3KBD6NuNcBeVsLVa80qNCdfaHQ6dWWIcUimfERK5CiMA7ChYF6K3aiKeKliSVXvo953drKdLqSbujjS61kc1AxIVjxZw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=marliere.net; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=marliere.net header.i=@marliere.net header.b=lgO/EBdK; arc=none smtp.client-ip=209.85.166.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=marliere.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marliere.net header.i=@marliere.net header.b="lgO/EBdK" Received: by mail-io1-f42.google.com with SMTP id ca18e2360f4ac-7c83fb0fa01so7786839f.1; Sat, 02 Mar 2024 09:06:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709399173; x=1710003973; h=cc:to:in-reply-to:references: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=qkQknDhSkTPBEJcvBIbzf1xbfRszRdjUE62WGVlTBO4=; b=EBdA5e5FdUSkfCHHH8Fo/byQMSHNqSVGZTVrttFhAVBwRD8wusMtYpJ8QSo9y+TFPQ l3FUCB34c35jfld6Z+mj5l19SezhEKHfAT90TPRzFrkld9JPnexTUlcjrGU5wWTBxc1r rcWm9aT7sPqIG/5KrTPOulZd0egndXcKUEKNRetJlzAj7jogjPYoU//LPQ9ewKN1KZt8 aBTDo6ajWER6jtKJe8fA+aSfHIDymHsTX5/vTBKzrgTvGzmyVNqqYKfpcGGi1Ape3MQg CNANUa6omnXAHLRlcjxQQKf3BmOueLf/UOCmWjJwJpuOtEOyjai/3TGQorD0ryQoXYqQ vnVQ== X-Forwarded-Encrypted: i=1; AJvYcCWTLNqr1LnBOv5lv4EnTan0SML5dRH7GGSHLqPgaVcsMni9p2oFj3eWq3Coe9U+66wuiYF2Gj2EkcySXYTdBBWuOSxVTx444NlbmGkueJ/5AiziVV4QYkGaN4GmkrpziMIV9hTitNthm7uV/Hxm1QIwkPoYxJ2bckd77LSZDWU5 X-Gm-Message-State: AOJu0Yx/eXi0sVpE0oq5uwrrBb42FMaJcbi/3WDmT9/VjDWAhvw+p4FQ SBQ24ZxSCVTQL9YFBG902HCb7Wtq5cEXGRZTySJy+khTRNp45Wxc X-Google-Smtp-Source: AGHT+IFKF/0fnojS8dxwoFURRfUU/yhv9Uym47Vom3oagAguAiEImvIVR1Th+CGHFHqktJ9Igua+4Q== X-Received: by 2002:a6b:c301:0:b0:7c8:289b:d52b with SMTP id t1-20020a6bc301000000b007c8289bd52bmr4340149iof.8.1709399172846; Sat, 02 Mar 2024 09:06:12 -0800 (PST) Received: from mail.marliere.net ([24.199.118.162]) by smtp.gmail.com with ESMTPSA id h18-20020a02c732000000b00474e0f1bb62sm198211jao.147.2024.03.02.09.06.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Mar 2024 09:06:12 -0800 (PST) From: "Ricardo B. Marliere" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marliere.net; s=2024; t=1709399171; 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: in-reply-to:in-reply-to:references:references; bh=qkQknDhSkTPBEJcvBIbzf1xbfRszRdjUE62WGVlTBO4=; b=lgO/EBdKsFURB9BjvQggwYhV74BArdT6Bi/vX037My5uVUG/BXFzBS63RoaYO2HDAwozUo i4ZS/cmDWWyCFtkwHw8nh5S13ozzdXe9Izdro4kRR6nDKlkmIj5hyZo7dUkMkzkqHFejNK KxTwd6/Xv2UwKU7cLA8RfINnbhO5r5YmDkuH5TtOtiL2dWmW3SmhZmCGKkHhhf1ik095cB k6HvBfbQL2OFrxZZbzWzxyW8g69Dv0GG1PEE8gN425vb44HnDK/mNBDxRq7JAQnLAZAG33 WQDLd1bUtfg0jclutPpMQVOiH782EAuax17TVjVDICFOWNzFOYQji3ojMkPlPg== Authentication-Results: ORIGINATING; auth=pass smtp.auth=ricardo@marliere.net smtp.mailfrom=ricardo@marliere.net Date: Sat, 02 Mar 2024 14:05:58 -0300 Subject: [PATCH net-next 2/6] net: wan: framer: make framer_class constant Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240302-class_cleanup-net-next-v1-2-8fa378595b93@marliere.net> References: <20240302-class_cleanup-net-next-v1-0-8fa378595b93@marliere.net> In-Reply-To: <20240302-class_cleanup-net-next-v1-0-8fa378595b93@marliere.net> To: Yisen Zhuang , Salil Mehta , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Loic Poulain , Sergey Ryazanov , Johannes Berg , Krzysztof Kozlowski Cc: Greg Kroah-Hartman , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-ppp@vger.kernel.org, "Ricardo B. Marliere" X-Developer-Signature: v=1; a=openpgp-sha256; l=2487; i=ricardo@marliere.net; h=from:subject:message-id; bh=qXay6ldHY4MUDiGqJdsMIllcHV6D4WAZhf81UWPWDoI=; b=owEBbQKS/ZANAwAKAckLinxjhlimAcsmYgBl41x6FpvslPW3+Hnipoif8zG6NNz9vWUarnRZj Vh5HSjveB6JAjMEAAEKAB0WIQQDCo6eQk7jwGVXh+HJC4p8Y4ZYpgUCZeNcegAKCRDJC4p8Y4ZY pj34D/48JcGskms2QqJ/QIvcNXC7rWmU2a6pGLoYtM0/eqQ3kUBSubHO/80oGkaXc7p5n8EcmLY gGvthKP5YMVqBj7FNl/DDH8R6GyjOHovYgveUAmc4y3B1i+ve4oLwB+4YUtQRU3nZFPPAPjfq1e rjR0899LBcfVlNnAdp6ZD+YdUmEyuXAHOzKwOvud3SlqaoeBC5V5L4RDBnl9aZ83Fa3AXuWIDPF Rrr4iEz8oPBlLOnZjJ5KVfpXTozms80A0yl6X0J3iOaFSb6LHj0keNNXUl0d1DWJmBYN6CoYObN dfrUMqFTbQDV9uV2DMifAZiFdFZeK6TNmRoyzHcc4jaJBzuEj4HNFsqeSFPR/Q8YA+EIFRf7gU8 zYHAIkNiN9N18pvvQ1fRUkYUZEBPUsEh/oOxnc0Lws5z9qMvFnh45UP2bOoAnkX3H43+rng96Cr s9rJ91xHws11tSYD29NPBD+5uCtgO9sRWqrs2OPZb5Nsm0wCR6IQtUkdy11Bs0S54KorrKBzFb8 NbQrO/oHCA2BtoEQXkRvfcQBMsA5YAZrGUWwWrEecHfoIMj70TYiLoAF+tdcVMnm8ZaxUfNH+69 /r/egaQB6tSElV/w4fAzt+1b3+r2kJtnmmLMNJzZNVt5MrvjDqBFyAVcQ6eQ/xr5qaevdWw1A6k LzwYgBxJnLTc+5Q== X-Developer-Key: i=ricardo@marliere.net; a=openpgp; fpr=030A8E9E424EE3C0655787E1C90B8A7C638658A6 X-Patchwork-Delegate: kuba@kernel.org Since commit 43a7206b0963 ("driver core: class: make class_register() take a const *"), the driver core allows for struct class to be in read-only memory, so move the framer_class structure to be declared at build time placing it into read-only memory, instead of having to be dynamically allocated at boot time. Cc: Greg Kroah-Hartman Suggested-by: Greg Kroah-Hartman Signed-off-by: Ricardo B. Marliere Reviewed-by: Simon Horman Acked-by: Herve Codina --- drivers/net/wan/framer/framer-core.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/drivers/net/wan/framer/framer-core.c b/drivers/net/wan/framer/framer-core.c index 33b358b99f70..f547c22e26ac 100644 --- a/drivers/net/wan/framer/framer-core.c +++ b/drivers/net/wan/framer/framer-core.c @@ -18,7 +18,12 @@ #include #include -static struct class *framer_class; +static void framer_release(struct device *dev); +static const struct class framer_class = { + .name = "framer", + .dev_release = framer_release, +}; + static DEFINE_MUTEX(framer_provider_mutex); static LIST_HEAD(framer_provider_list); static DEFINE_IDA(framer_ida); @@ -627,7 +632,7 @@ struct framer *framer_create(struct device *dev, struct device_node *node, INIT_DELAYED_WORK(&framer->polling_work, framer_polling_work); BLOCKING_INIT_NOTIFIER_HEAD(&framer->notifier_list); - framer->dev.class = framer_class; + framer->dev.class = &framer_class; framer->dev.parent = dev; framer->dev.of_node = node ? node : dev->of_node; framer->id = id; @@ -741,7 +746,7 @@ struct framer *framer_provider_simple_of_xlate(struct device *dev, struct class_dev_iter iter; struct framer *framer; - class_dev_iter_init(&iter, framer_class, NULL, NULL); + class_dev_iter_init(&iter, &framer_class, NULL, NULL); while ((dev = class_dev_iter_next(&iter))) { framer = dev_to_framer(dev); if (args->np != framer->dev.of_node) @@ -870,14 +875,6 @@ static void framer_release(struct device *dev) static int __init framer_core_init(void) { - framer_class = class_create("framer"); - if (IS_ERR(framer_class)) { - pr_err("failed to create framer class (%pe)\n", framer_class); - return PTR_ERR(framer_class); - } - - framer_class->dev_release = framer_release; - - return 0; + return class_register(&framer_class); } device_initcall(framer_core_init); From patchwork Sat Mar 2 17:05:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ricardo B. Marliere" X-Patchwork-Id: 13579577 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-io1-f45.google.com (mail-io1-f45.google.com [209.85.166.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 24ACD3717A; Sat, 2 Mar 2024 17:06:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709399178; cv=none; b=mUyOixlSuiaA6LZ6NoF+JeH9jAP5oi+UPuI82cRvFf0yOTZtf7o/hiiKPTLm9CWsx4OZ/eZLfS/RQrj+Aer2YaWMjKvNDuoTj878ojMqWtcRFflL5M5CTpum26j06bKoGTNUG/7o3I6RmZHgAYlGK/KKqpTuqOKBtI3Lc4bTsJY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709399178; c=relaxed/simple; bh=T5RHgTXkjqfFzaWYcAqOoCPHNlVX677Ll7gcmiR/4d4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bLkS2ssAdqAY7fUzQdT/DDhXj+WY+f7s2sKROis84mD6YaZOv0nXR6Hsoi03C4aSzXvHnC7YH8thqdBJ1YgJdGEhrWnRCAOcJ1LMkjcsHKyKSToJM9QDYKrYRw3LDTxIHrjuP1i7pn2wf1Q0G+EGJFEn+nw54pDHeMsH81QqdVY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=marliere.net; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=marliere.net header.i=@marliere.net header.b=HB34JzSy; arc=none smtp.client-ip=209.85.166.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=marliere.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marliere.net header.i=@marliere.net header.b="HB34JzSy" Received: by mail-io1-f45.google.com with SMTP id ca18e2360f4ac-7c7ee7fa1d8so140411139f.1; Sat, 02 Mar 2024 09:06:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709399176; x=1710003976; h=cc:to:in-reply-to:references: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=b8KHE2YH607pBREjJO3u7sJ6tDIBnjDyXQnIFsVTeqY=; b=LfbuZZeQeGJ5d9wkcCPBL0Oq6zsRLn01b7r6Tc48hYZ8Zkf5/+RSqDaDTMtLLVGquq RltPWchQ0RIIKdhxz0wH7KJFDIMdjG0Q22SNeMq7U48I8PF54/0LI9FkYRXRDxic8wh6 JmdyG4OQNiNNm7+SRvoMKR+RPk5EqrlRhh8/pHGMRR21D4QRZjOzyRcClMUTidqV7v/E C2HyVCazfFihm2ED/M2Qb/ODbMmml5cDBpMLyGfysZ2ODF3bBJaXUM4MZQwe4E7+qYkN J12Y/FntkNdclSjf37NZRKMFeJwTula+sfOTatfYoru3PEg9MJIulilWJ2QnmOJ1pDcm uk5A== X-Forwarded-Encrypted: i=1; AJvYcCXAljaP6nM3Oc+7If+J4aDqgksihDh1WQO2jgEn1E0Yk/K/ZzeOHHltedrdbsOxiCeMA6/OBjVWDjfUux+H2ag45WohrHCnvqXkTO93KDnsvK+0Ew9Ohsmv6gJRpGokSkiCOxJVXBSAaifh0YRaf0aX6VBwxUUkvlULhjq0xUHX X-Gm-Message-State: AOJu0YwQ6D5cT9Xxtw4blUzuK4ehqAbPaMIZD3intGV0Vhp0+1VAz85y XmQtuF3iMR5qML+lRyoskxUke8/KASaZ6dsjSitoy9uDe5IKBg8D X-Google-Smtp-Source: AGHT+IGVpHlEAfc56PmD4qt6WtuhWaH3SeIK+MD+sx+501qtfzHvsBRUKn8NzTidX1rkmcc4roOfiQ== X-Received: by 2002:a5e:8a0c:0:b0:7c8:3580:a484 with SMTP id d12-20020a5e8a0c000000b007c83580a484mr1816606iok.5.1709399176188; Sat, 02 Mar 2024 09:06:16 -0800 (PST) Received: from mail.marliere.net ([24.199.118.162]) by smtp.gmail.com with ESMTPSA id t11-20020a056638348b00b00474d0d15c8esm794499jal.151.2024.03.02.09.06.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Mar 2024 09:06:15 -0800 (PST) From: "Ricardo B. Marliere" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marliere.net; s=2024; t=1709399174; 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: in-reply-to:in-reply-to:references:references; bh=b8KHE2YH607pBREjJO3u7sJ6tDIBnjDyXQnIFsVTeqY=; b=HB34JzSyq2N83bfG+mR604/U75HzFPLqDySYvjvgLfkPpe2z/Tf5PfC8d0zTcIpYT2+vYj 2QLTibjmLNhd0u1SDYAHGSyTGlCSzSRTe+Kgzj12dC2olzgPHLTxaQ2hSbXfuDtHG/+trI 04Fr+RfLszvAUB9KqUQvuUp22znJOh9X2Cl1jkiTYSbv9o3j7ZY0jHU+OmMkSO1DiC2wp3 iqNmPjr7a4G0o1PcEDHVPujywpbLR9hZPNHmyroSy2m3LG1IERq4nFa6UqBHc1bfmKWzgT 3krpFy1JfA/aniBvVi7L0alRZHvp9GHrJ0rzFEZyJpXYsjzIGLbZzlPCb3uFEg== Authentication-Results: ORIGINATING; auth=pass smtp.auth=ricardo@marliere.net smtp.mailfrom=ricardo@marliere.net Date: Sat, 02 Mar 2024 14:05:59 -0300 Subject: [PATCH net-next 3/6] net: ppp: make ppp_class constant Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240302-class_cleanup-net-next-v1-3-8fa378595b93@marliere.net> References: <20240302-class_cleanup-net-next-v1-0-8fa378595b93@marliere.net> In-Reply-To: <20240302-class_cleanup-net-next-v1-0-8fa378595b93@marliere.net> To: Yisen Zhuang , Salil Mehta , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Loic Poulain , Sergey Ryazanov , Johannes Berg , Krzysztof Kozlowski Cc: Greg Kroah-Hartman , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-ppp@vger.kernel.org, "Ricardo B. Marliere" X-Developer-Signature: v=1; a=openpgp-sha256; l=2263; i=ricardo@marliere.net; h=from:subject:message-id; bh=T5RHgTXkjqfFzaWYcAqOoCPHNlVX677Ll7gcmiR/4d4=; b=owEBbQKS/ZANAwAKAckLinxjhlimAcsmYgBl41x6r2Q+NxH/tGuFTIUpuCbT5vFEjCgvKhnle OTiQs5XXR6JAjMEAAEKAB0WIQQDCo6eQk7jwGVXh+HJC4p8Y4ZYpgUCZeNcegAKCRDJC4p8Y4ZY pjcAD/9Ocxcjd9VCBOdPx2sCmFRHlXr5EkMe1h+E54GC5DKLQVjEEaGe9WMHvHK6QAZY/wBTAnO CygXOsLNmbDxU3n/0oD6NH2VQVOzXjHAcZQvPzIaN+f4iWrELfIGUJUHJH8P6wPHXjaMDpsLZkq S4zhcFvvGmNIXfsUifj7JaIEZL7MkSQQMHbBROzJmy5M4x8IvlqZCpS9iT9WCpEY5TV66BLRACT rp+67mwLveb6mV37ST+5jPiMhmQfQv7RAftuBTg98KXJ1ERF1jwaWZ7QRJsh/NP3O124KfJa4hx VRdRQCEI9cBbUPfbKhevhOS+Ybq8nRab3wljyZQD2AQN+n/jVd23VKVwJldz9peTnJet7+/rNE+ S58ee2JieVFMvv3G7A2GQVi+h94Zp5gxr8IotiSCIK1aUpAIfMLNM9Ld6fbh01vT5eL+KdoQfzM ylm1EvPEB6dsH3uC68Dp4972IVtfzUv/+jFIvTsvA9OGU8e/F82isGAg8A1fgQ8a19Isrog2zd5 0BhPcsvq0i7aqv0o/J3uMGiatLDoXKdzAHglougN5mTchCwY9IjgOmNLMcrSx00DHl39KHiqnNd DirBsWhuuxr5tfn3OFD29Y2fEVL8AxDzw8NcJ9yqUiJiJpNdYQtzUbiQ1hlqF8VIvh0e3dTTMOR AnhbHzf7P3W2L3Q== X-Developer-Key: i=ricardo@marliere.net; a=openpgp; fpr=030A8E9E424EE3C0655787E1C90B8A7C638658A6 X-Patchwork-Delegate: kuba@kernel.org Since commit 43a7206b0963 ("driver core: class: make class_register() take a const *"), the driver core allows for struct class to be in read-only memory, so move the ppp_class structure to be declared at build time placing it into read-only memory, instead of having to be dynamically allocated at boot time. Cc: Greg Kroah-Hartman Suggested-by: Greg Kroah-Hartman Signed-off-by: Ricardo B. Marliere Reviewed-by: Simon Horman --- drivers/net/ppp/ppp_generic.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c index db1d11ae817b..fe380fe196e7 100644 --- a/drivers/net/ppp/ppp_generic.c +++ b/drivers/net/ppp/ppp_generic.c @@ -295,7 +295,9 @@ static void ppp_setup(struct net_device *dev); static const struct net_device_ops ppp_netdev_ops; -static struct class *ppp_class; +static const struct class ppp_class = { + .name = "ppp", +}; /* per net-namespace data */ static inline struct ppp_net *ppp_pernet(struct net *net) @@ -1394,11 +1396,9 @@ static int __init ppp_init(void) goto out_net; } - ppp_class = class_create("ppp"); - if (IS_ERR(ppp_class)) { - err = PTR_ERR(ppp_class); + err = class_register(&ppp_class); + if (err) goto out_chrdev; - } err = rtnl_link_register(&ppp_link_ops); if (err) { @@ -1407,12 +1407,12 @@ static int __init ppp_init(void) } /* not a big deal if we fail here :-) */ - device_create(ppp_class, NULL, MKDEV(PPP_MAJOR, 0), NULL, "ppp"); + device_create(&ppp_class, NULL, MKDEV(PPP_MAJOR, 0), NULL, "ppp"); return 0; out_class: - class_destroy(ppp_class); + class_unregister(&ppp_class); out_chrdev: unregister_chrdev(PPP_MAJOR, "ppp"); out_net: @@ -3549,8 +3549,8 @@ static void __exit ppp_cleanup(void) pr_err("PPP: removing module but units remain!\n"); rtnl_link_unregister(&ppp_link_ops); unregister_chrdev(PPP_MAJOR, "ppp"); - device_destroy(ppp_class, MKDEV(PPP_MAJOR, 0)); - class_destroy(ppp_class); + device_destroy(&ppp_class, MKDEV(PPP_MAJOR, 0)); + class_unregister(&ppp_class); unregister_pernet_device(&ppp_net_ops); } From patchwork Sat Mar 2 17:06:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ricardo B. Marliere" X-Patchwork-Id: 13579578 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-io1-f47.google.com (mail-io1-f47.google.com [209.85.166.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 3E07D2BAF6; Sat, 2 Mar 2024 17:06:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709399181; cv=none; b=QUl8WFkujw3xHLiw/zZ44vbueTX2+8mD1JvWVL8Ndy6Egix7SDd56yfaq8WWZc3dDjjXpJ6vpsrsxU/gIrksJ6eSA+sS8FUYYVW072dyAkjk7fAlAQIo0CLinItPUt07VJ2dYTZPwpmYD+nqrB6Jl7i58hag614Swfo5kuZuEHY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709399181; c=relaxed/simple; bh=S0SNqxhR+Qde3qiIJKcqBx5TILtF21c2fHB6D4dCT7s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PQSbzagBbl6gAKhrog99kAdMuJgSZVTevQspai+KwaKD8654jHb3GvnNRG8Ed3xMaWJ53LTlBxzMdyAoutAYC0+F6uvJgqXBUChF3w3gj6GA7MrHdQy5Qrdsxh6hUgKw+edTyj6ayXYaAGiahytzsf1H5A8kN6PxB0xTr9QWO00= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=marliere.net; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=marliere.net header.i=@marliere.net header.b=ZWWsmq+c; arc=none smtp.client-ip=209.85.166.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=marliere.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marliere.net header.i=@marliere.net header.b="ZWWsmq+c" Received: by mail-io1-f47.google.com with SMTP id ca18e2360f4ac-7c8357ec478so24007639f.2; Sat, 02 Mar 2024 09:06:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709399179; x=1710003979; h=cc:to:in-reply-to:references: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=f42hWAkceI9x+ucGKynLa/O9HVdUbJVbey5+2rTsSyI=; b=ScwJzZdRSpJk2pOcv9oGH7tG4uetNZO9ujhh1+jyJdCrXm0DFebKRtZuwlBXvHDlrZ GXMEuMZgE6jsco/B3aBRyYQVwRyvqf1hJkHScpziiRyyaH9hkFviMinR3SximFxKjVL5 liabChzMy6MjHYc5SvNppcX7yToHomCbGLpTQ2c+miZcHi9CghhVeNuPfOGxmXJDzXAP xC6dfN9rJo+UOOiCg1X7j1v82IdLK3XbN1fBTkCmm5sgABibru/d+K0BG4Rl4z5nWjuc ZGDvQ6NXs8T3KJjBePKofIz9/mshjeXOGcq/MkMhu8kmVsvWv2baesvBumRafvik7GEw qZkQ== X-Forwarded-Encrypted: i=1; AJvYcCUfS0RfKj6invCc7TDKWkcE2wapIvb5lh/uh3JA+Zj5HHIBUthrcG4VFf2/8wC/vHnA/kOy/lsROxuIJp0ValDLePOW11lI2NPf11dsDMOUnxMDfoWFJ5dKOzNdEgIPadftC3bl6w5Djgfz5EONRn6sMKIQACE2oGlgiGAPXySY X-Gm-Message-State: AOJu0YzkuUfp5EBKKUCKgUZ4i6RYW1h6nDn54s/FmGfE/foq/BsYhun7 R3flwXqIFI0rc0mYI7Pb44XRdt1wgTP8lriqYjhKkDmsFWdYSxHz X-Google-Smtp-Source: AGHT+IH6DiLAG+yoxNyadLBjdMZLlZWW/rQdF0n+2lzz76Z/yD77v+WTgmwEaBRLE45cHVaFqfAiwg== X-Received: by 2002:a05:6602:4f98:b0:7c8:3eac:2e22 with SMTP id gr24-20020a0566024f9800b007c83eac2e22mr1138664iob.17.1709399179416; Sat, 02 Mar 2024 09:06:19 -0800 (PST) Received: from mail.marliere.net ([24.199.118.162]) by smtp.gmail.com with ESMTPSA id p13-20020a02b38d000000b004747b3a095bsm1398226jan.72.2024.03.02.09.06.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Mar 2024 09:06:19 -0800 (PST) From: "Ricardo B. Marliere" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marliere.net; s=2024; t=1709399177; 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: in-reply-to:in-reply-to:references:references; bh=f42hWAkceI9x+ucGKynLa/O9HVdUbJVbey5+2rTsSyI=; b=ZWWsmq+c1nnTfC4U9vrH0zk9vxnWsQmeVQbM6MLmkzDnrW75RrwgelLEak9xberCI6nXsd T+uhrG6UDFMaeAWY3ly0qh9IR2dLaCq+ftYtaqp3UFEJejofdk83VwJVb8lUYMkZ+9A/UF TJS5ae5XvVX78L8HwThhGYI/iHlzG4+NVONW91xIiTjZgzPSJv1Aad0C8dLdbEkyCpoXtW 9gEXrdH0QsPrN+/NjD6O+HA1iUg88D3yyo/7IvpdOGXruAQtdT2lvEjK9ImIm6U8nAXxOq KlLT++RZqbRSVSI8w27gtTk+Vyd80KjoVwf7U5OesunWUq3uTFsWuBDtljv2qA== Authentication-Results: ORIGINATING; auth=pass smtp.auth=ricardo@marliere.net smtp.mailfrom=ricardo@marliere.net Date: Sat, 02 Mar 2024 14:06:00 -0300 Subject: [PATCH net-next 4/6] net: wwan: hwsim: make wwan_hwsim_class constant Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240302-class_cleanup-net-next-v1-4-8fa378595b93@marliere.net> References: <20240302-class_cleanup-net-next-v1-0-8fa378595b93@marliere.net> In-Reply-To: <20240302-class_cleanup-net-next-v1-0-8fa378595b93@marliere.net> To: Yisen Zhuang , Salil Mehta , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Loic Poulain , Sergey Ryazanov , Johannes Berg , Krzysztof Kozlowski Cc: Greg Kroah-Hartman , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-ppp@vger.kernel.org, "Ricardo B. Marliere" X-Developer-Signature: v=1; a=openpgp-sha256; l=2613; i=ricardo@marliere.net; h=from:subject:message-id; bh=S0SNqxhR+Qde3qiIJKcqBx5TILtF21c2fHB6D4dCT7s=; b=owEBbQKS/ZANAwAKAckLinxjhlimAcsmYgBl41x7PIn9h6DiIn4p0ZhBbaWhSshotQp6jbG0k zCYQwu7CheJAjMEAAEKAB0WIQQDCo6eQk7jwGVXh+HJC4p8Y4ZYpgUCZeNcewAKCRDJC4p8Y4ZY pssED/9/BSsDoMJUMcQTtRddN3E0h5+/iGPBIJI9CMiHKRv12vxJsVPkGCrD9QOXyQIhHl7krpp /Op8uKVMD9U+Gf+y/8qsB3MMYuHznJJ5UTdXsklJECEM/oQvpok3oEWlPrwb9yZZkzPySI15rc4 BmUNQpvOIySiCSk1hixiAB9bepsZnQzi50xzgfsODG3y8Bo+tjaiGVkMD66C+pbWcs+Ri4L6khq IZaK5J/7cB/1ZlFuB8IguXJ2g8NJrt13sxIO7v3iwn2J2hlms/UMW0Ja0FJTaoTaJk8IXP6tnDu dOkXJZPU0AzV7qigCi3HhhaAVEPKd+d7/Zhq6pTfqA8YpcSAynURsEDFSqGDVeiOAg+VFp9LnUL Qqj+G+bHy4eIXcrT5NA4fHQ52/cNbopm9+UyKZa6Hcq/RKgLWU/nhzlB/8eRtIZl557KIagOFX7 +VE+OtdCDj/+y7gh749z8DsnRlzIHfRj0RLuInMPzVmxhjqQ4J2PEtwOuv1HJSfkLB/duNyoC5b 9OT+xSF28Uvs/4pMphSKVaa3hVIvu0C+k1YPA+ImWdgl2eZa3RtAHg+rourMcLbdkknnPvxY7bV AnpALrO5c+AL8h9ZUF1FXUEJ0jQ+einKLFa4wF80si47OFxp+M4droDg1F1k4myc1Fsp7jzgzyu HaPBHeSkdAqEpeA== X-Developer-Key: i=ricardo@marliere.net; a=openpgp; fpr=030A8E9E424EE3C0655787E1C90B8A7C638658A6 X-Patchwork-Delegate: kuba@kernel.org Since commit 43a7206b0963 ("driver core: class: make class_register() take a const *"), the driver core allows for struct class to be in read-only memory, so move the wwan_hwsim_class structure to be declared at build time placing it into read-only memory, instead of having to be dynamically allocated at boot time. Cc: Greg Kroah-Hartman Suggested-by: Greg Kroah-Hartman Signed-off-by: Ricardo B. Marliere Acked-by: Sergey Ryazanov --- drivers/net/wwan/wwan_hwsim.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/wwan/wwan_hwsim.c b/drivers/net/wwan/wwan_hwsim.c index ff3dd24ddb33..b02befd1b6fb 100644 --- a/drivers/net/wwan/wwan_hwsim.c +++ b/drivers/net/wwan/wwan_hwsim.c @@ -25,7 +25,9 @@ static int wwan_hwsim_devsnum = 2; module_param_named(devices, wwan_hwsim_devsnum, int, 0444); MODULE_PARM_DESC(devices, "Number of simulated devices"); -static struct class *wwan_hwsim_class; +static const struct class wwan_hwsim_class = { + .name = "wwan_hwsim", +}; static struct dentry *wwan_hwsim_debugfs_topdir; static struct dentry *wwan_hwsim_debugfs_devcreate; @@ -277,7 +279,7 @@ static struct wwan_hwsim_dev *wwan_hwsim_dev_new(void) spin_unlock(&wwan_hwsim_devs_lock); dev->dev.release = wwan_hwsim_dev_release; - dev->dev.class = wwan_hwsim_class; + dev->dev.class = &wwan_hwsim_class; dev_set_name(&dev->dev, "hwsim%u", dev->id); spin_lock_init(&dev->ports_lock); @@ -511,11 +513,9 @@ static int __init wwan_hwsim_init(void) if (!wwan_wq) return -ENOMEM; - wwan_hwsim_class = class_create("wwan_hwsim"); - if (IS_ERR(wwan_hwsim_class)) { - err = PTR_ERR(wwan_hwsim_class); + err = class_register(&wwan_hwsim_class); + if (err) goto err_wq_destroy; - } wwan_hwsim_debugfs_topdir = debugfs_create_dir("wwan_hwsim", NULL); wwan_hwsim_debugfs_devcreate = @@ -534,7 +534,7 @@ static int __init wwan_hwsim_init(void) wwan_hwsim_free_devs(); flush_workqueue(wwan_wq); /* Wait deletion works completion */ debugfs_remove(wwan_hwsim_debugfs_topdir); - class_destroy(wwan_hwsim_class); + class_unregister(&wwan_hwsim_class); err_wq_destroy: destroy_workqueue(wwan_wq); @@ -547,7 +547,7 @@ static void __exit wwan_hwsim_exit(void) wwan_hwsim_free_devs(); flush_workqueue(wwan_wq); /* Wait deletion works completion */ debugfs_remove(wwan_hwsim_debugfs_topdir); - class_destroy(wwan_hwsim_class); + class_unregister(&wwan_hwsim_class); destroy_workqueue(wwan_wq); } From patchwork Sat Mar 2 17:06:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ricardo B. Marliere" X-Patchwork-Id: 13579579 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-io1-f54.google.com (mail-io1-f54.google.com [209.85.166.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 5D0E438DDA; Sat, 2 Mar 2024 17:06:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709399185; cv=none; b=jrIK1KGamv7KKLfiTERGkRvBvHUnE9H1YMRoBU0RDKyL/vkg5xnoHgFxYZntcAO2LRxYyqJ57E/oy7MRC3+kcnYfQBwTL1QPMl9om2bvAulezTEPA/HLZx57SspDtUsbZ3f/VkWW9ZY2ROtHx21IHZez01kYjE0vmJYhYjKOq0o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709399185; c=relaxed/simple; bh=q6vp3+8mdT9ke18jOPZ8IaTV2bgo1pFOrhJ1Llyor6I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JW8tiflCBvrMaT3zQvy1GbqyxfVcVwTUCQsipGiyXHEeHe9TUaP4Cp9FqsfvoahWB6KOXX0MLdpWPd/4JSqjNLmL968BXf6Gny9E4pp8QHq22AsKWfeQa8ssCA9gwKJtFmPhEe58P7LSxpfTA1dta2KEDO0eBANpmJVp6ahrD7g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=marliere.net; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=marliere.net header.i=@marliere.net header.b=aDAOv14x; arc=none smtp.client-ip=209.85.166.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=marliere.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marliere.net header.i=@marliere.net header.b="aDAOv14x" Received: by mail-io1-f54.google.com with SMTP id ca18e2360f4ac-7c3e4290f5fso163376439f.2; Sat, 02 Mar 2024 09:06:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709399182; x=1710003982; h=cc:to:in-reply-to:references: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=7mLkfb6xqdDWlIC5cLbzUm8KpUhI1ndnLDADNoVaF9A=; b=M0fTRq9OM+rDLFSqKXFPHs/cH5JDYT2+KfjhpI60u5mQ3g/3KRlCiq8YMDMhwvbgoU GJcRzlEzgTTU3umU96BgqWYCiI4MwyCOYHHM2qWd1zqkNSCiZXs4HjYPzaG97swff/Su Y3Wyw4Re1zcCP1rYSsTLkX2lcrl4jmcyObht4ySaZbyKOmz/+o8zd/FXJZhSW+7eiZox n8eE6alEO+jM88hpmaKxhF908QagGVW+qXx9W5h+860AYUaJMKibzF+CUAaAKQty5uXj DHhzbzq2Otlb1UOnrX0LJfy7QITVXGJUPAog9U6vzZGY3rzbPNFCNP+L5KWzPU1FcNHF 5kMA== X-Forwarded-Encrypted: i=1; AJvYcCVbGLCyvdq5HDYhl2m5f8W45pmEjLo5o3pA6NjfrY26Yj1AUH8PKwuovCDWq2Pdy8uTehaBinnMIFGm+wf7fxd98lUaoN7f6wM8uXW2Wd1oyDWdGWepyjrt76LUbXzAC4ILWOuYz40gXOKq9cP6+htatotFn9akCQYCQ+SAzZl7 X-Gm-Message-State: AOJu0YyXIKTlbF6dRvFxTTC96FN2fC5JKTwN2av786Ad89J3YOeasj3f 7LpsaFpo8IIE6jjN3ctI/R0YypC8GvWBg8iag9sfXYE+y2nKrBtHXzBqtWPB0fosvg== X-Google-Smtp-Source: AGHT+IE7fooeYIZALUK0/kkpc3s4J/o5B74kIXovwl27v578kcY+B4eSsapjiou0IV3VjBQG9dorSg== X-Received: by 2002:a5e:a907:0:b0:7c7:a0c8:1730 with SMTP id c7-20020a5ea907000000b007c7a0c81730mr4581815iod.20.1709399182535; Sat, 02 Mar 2024 09:06:22 -0800 (PST) Received: from mail.marliere.net ([24.199.118.162]) by smtp.gmail.com with ESMTPSA id g16-20020a056638061000b0047483de6cd5sm1396756jar.112.2024.03.02.09.06.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Mar 2024 09:06:22 -0800 (PST) From: "Ricardo B. Marliere" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marliere.net; s=2024; t=1709399181; 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: in-reply-to:in-reply-to:references:references; bh=7mLkfb6xqdDWlIC5cLbzUm8KpUhI1ndnLDADNoVaF9A=; b=aDAOv14x5ldmESwgxyc7EO7SJhHTbh2dMxMz5UFZQxZNa8HYhEVmDNQhpnMgJ+G+t8N6ZC U5h+hI3lXs/fD1T+DfepLjjR52tmEa5Rr97fUXAnWNDwfXSUchSAzct2iXuR/WKnwN06yC j0rHtZHODPtQZ58foww1F6L8vGzmid/ttmIekOjXvuTRjbllNMktpBnwTmdRtTSlpaiFWZ 8sTVepzi4c1mpvvRcp5Wc3RVZNwU9XGV85fB45q8SqEXqvZluCSVxw/VdG1/nLF9dZuIQ0 osrvErQjyujq8b9rXTC2mRrcrIpBan9UXtczmiwNuvOhpUkj8aOUj3Yt9ID8Sg== Authentication-Results: ORIGINATING; auth=pass smtp.auth=ricardo@marliere.net smtp.mailfrom=ricardo@marliere.net Date: Sat, 02 Mar 2024 14:06:01 -0300 Subject: [PATCH net-next 5/6] net: wwan: core: make wwan_class constant Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240302-class_cleanup-net-next-v1-5-8fa378595b93@marliere.net> References: <20240302-class_cleanup-net-next-v1-0-8fa378595b93@marliere.net> In-Reply-To: <20240302-class_cleanup-net-next-v1-0-8fa378595b93@marliere.net> To: Yisen Zhuang , Salil Mehta , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Loic Poulain , Sergey Ryazanov , Johannes Berg , Krzysztof Kozlowski Cc: Greg Kroah-Hartman , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-ppp@vger.kernel.org, "Ricardo B. Marliere" X-Developer-Signature: v=1; a=openpgp-sha256; l=4775; i=ricardo@marliere.net; h=from:subject:message-id; bh=q6vp3+8mdT9ke18jOPZ8IaTV2bgo1pFOrhJ1Llyor6I=; b=owEBbQKS/ZANAwAKAckLinxjhlimAcsmYgBl41x7MzsX/wA9I0357Es+CRJdK5xDsj4ES4Bh6 g+gaAOs/bmJAjMEAAEKAB0WIQQDCo6eQk7jwGVXh+HJC4p8Y4ZYpgUCZeNcewAKCRDJC4p8Y4ZY pgMsD/9kOsyQD5q2v4UbGn6nyAJ/LT0AnVADF2uBv7N4SW6lDlbgN44QlXYoHBgvuR8rg2eQNj+ /WME4E/6OGpY30mmAGt8dAv5UcesLokex8pWYi43wgwEwg23nvV8U5hJmf6pJZ8GOUofVcv5GdN ZOpgGz1XLl45Hij0XNbNXMbFOcGqRJkCo/jXUDlE8SAOUOEnvr1UZh46Wo8RQtu8QBWRT9ASTA/ hw6SY1wuoPu4tUJ9BaQKU/OtXZIOcoGwSMmtvST3fEsD2AKNVZ5pMC17eg6EBtFoILED/7Min3A T0rhmDzmCjh1PK8MytJKZZWEVb2mCfh2OQTaEZZfDjtjTE34X3T9onoz5P+ii7VItvDxs11L+oY VgMuLdPbe6xK4nqY8b2Ef3t16znmSzvVEThE+l+6iBMjvjtMUBBL9lnoKjFdoarPEJoNFXq4TVV Yr5BlukkS0pmXWwa/eKQpl/k5npg6Y/mjBTlIBrCp15/YxxM2RxhKzTRP93DB4wmpLdZiuXgp1n c9tAsWal73m+MgwsAhOwd4s6B4UIc7xZGRVSg7x5JeDrpXU1o3o5kPgMi67mYp58hV8SICK9AgJ gj0U09N9Mg25zHHTAMhhZydx1oni7CSLvpqmQWRcLkP6BSUduSVffjeq81NH8hRycMmqLKxyJX/ ui18cJ/50YCASPA== X-Developer-Key: i=ricardo@marliere.net; a=openpgp; fpr=030A8E9E424EE3C0655787E1C90B8A7C638658A6 X-Patchwork-Delegate: kuba@kernel.org Since commit 43a7206b0963 ("driver core: class: make class_register() take a const *"), the driver core allows for struct class to be in read-only memory, so move the wwan_class structure to be declared at build time placing it into read-only memory, instead of having to be dynamically allocated at boot time. Cc: Greg Kroah-Hartman Suggested-by: Greg Kroah-Hartman Signed-off-by: Ricardo B. Marliere Acked-by: Sergey Ryazanov --- drivers/net/wwan/wwan_core.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/net/wwan/wwan_core.c b/drivers/net/wwan/wwan_core.c index b0030f3ed0f0..17431f1b1a0c 100644 --- a/drivers/net/wwan/wwan_core.c +++ b/drivers/net/wwan/wwan_core.c @@ -26,7 +26,9 @@ static DEFINE_MUTEX(wwan_register_lock); /* WWAN device create|remove lock */ static DEFINE_IDA(minors); /* minors for WWAN port chardevs */ static DEFINE_IDA(wwan_dev_ids); /* for unique WWAN device IDs */ -static struct class *wwan_class; +static const struct class wwan_class = { + .name = "wwan", +}; static int wwan_major; static struct dentry *wwan_debugfs_dir; @@ -130,7 +132,7 @@ static struct wwan_device *wwan_dev_get_by_parent(struct device *parent) { struct device *dev; - dev = class_find_device(wwan_class, NULL, parent, wwan_dev_parent_match); + dev = class_find_device(&wwan_class, NULL, parent, wwan_dev_parent_match); if (!dev) return ERR_PTR(-ENODEV); @@ -147,7 +149,7 @@ static struct wwan_device *wwan_dev_get_by_name(const char *name) { struct device *dev; - dev = class_find_device(wwan_class, NULL, name, wwan_dev_name_match); + dev = class_find_device(&wwan_class, NULL, name, wwan_dev_name_match); if (!dev) return ERR_PTR(-ENODEV); @@ -183,7 +185,7 @@ static struct wwan_device *wwan_dev_get_by_debugfs(struct dentry *dir) { struct device *dev; - dev = class_find_device(wwan_class, NULL, dir, wwan_dev_debugfs_match); + dev = class_find_device(&wwan_class, NULL, dir, wwan_dev_debugfs_match); if (!dev) return ERR_PTR(-ENODEV); @@ -239,7 +241,7 @@ static struct wwan_device *wwan_create_dev(struct device *parent) } wwandev->dev.parent = parent; - wwandev->dev.class = wwan_class; + wwandev->dev.class = &wwan_class; wwandev->dev.type = &wwan_dev_type; wwandev->id = id; dev_set_name(&wwandev->dev, "wwan%d", wwandev->id); @@ -265,7 +267,7 @@ static struct wwan_device *wwan_create_dev(struct device *parent) static int is_wwan_child(struct device *dev, void *data) { - return dev->class == wwan_class; + return dev->class == &wwan_class; } static void wwan_remove_dev(struct wwan_device *wwandev) @@ -375,7 +377,7 @@ static struct wwan_port *wwan_port_get_by_minor(unsigned int minor) { struct device *dev; - dev = class_find_device(wwan_class, NULL, &minor, wwan_port_minor_match); + dev = class_find_device(&wwan_class, NULL, &minor, wwan_port_minor_match); if (!dev) return ERR_PTR(-ENODEV); @@ -405,7 +407,7 @@ static int __wwan_port_dev_assign_name(struct wwan_port *port, const char *fmt) return -ENOMEM; /* Collect ids of same name format ports */ - class_dev_iter_init(&iter, wwan_class, NULL, &wwan_port_dev_type); + class_dev_iter_init(&iter, &wwan_class, NULL, &wwan_port_dev_type); while ((dev = class_dev_iter_next(&iter))) { if (dev->parent != &wwandev->dev) continue; @@ -477,7 +479,7 @@ struct wwan_port *wwan_create_port(struct device *parent, mutex_init(&port->data_lock); port->dev.parent = &wwandev->dev; - port->dev.class = wwan_class; + port->dev.class = &wwan_class; port->dev.type = &wwan_port_dev_type; port->dev.devt = MKDEV(wwan_major, minor); dev_set_drvdata(&port->dev, drvdata); @@ -1212,11 +1214,9 @@ static int __init wwan_init(void) if (err) return err; - wwan_class = class_create("wwan"); - if (IS_ERR(wwan_class)) { - err = PTR_ERR(wwan_class); + err = class_register(&wwan_class); + if (err) goto unregister; - } /* chrdev used for wwan ports */ wwan_major = __register_chrdev(0, 0, WWAN_MAX_MINORS, "wwan_port", @@ -1233,7 +1233,7 @@ static int __init wwan_init(void) return 0; destroy: - class_destroy(wwan_class); + class_unregister(&wwan_class); unregister: rtnl_link_unregister(&wwan_rtnl_link_ops); return err; @@ -1244,7 +1244,7 @@ static void __exit wwan_exit(void) debugfs_remove_recursive(wwan_debugfs_dir); __unregister_chrdev(wwan_major, 0, WWAN_MAX_MINORS, "wwan_port"); rtnl_link_unregister(&wwan_rtnl_link_ops); - class_destroy(wwan_class); + class_unregister(&wwan_class); } module_init(wwan_init); From patchwork Sat Mar 2 17:06:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ricardo B. Marliere" X-Patchwork-Id: 13579580 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-il1-f177.google.com (mail-il1-f177.google.com [209.85.166.177]) (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 9E71839875; Sat, 2 Mar 2024 17:06:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709399188; cv=none; b=qZhwICAWIPu7XT+y2pbA94CKL2KzbZhpsNr4r/bJmg9cR3Uf1agi42sZ775/fjgX4nHPGYXmwIrFBl4jJo7mH1nyIvkm+umVTIkAPplFJ+dG3Gl5ew/OvsXbdkyY4eeY7i0Q6r3UCVnXqYN24RGGRN3XRPEf4Ch0rEgrx1E0NqM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709399188; c=relaxed/simple; bh=RjXjt1NVx4j7b9346cDcfgKuL3rftAXS2K6j8XwIzlA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=AJVtXlQGtrkuPsw+RyMiFGxel8ab6wZLeX8TacK9CZ8MbB+TB7kwBgDGSz30ghI+S3mJMvsazsLEwdr6wa+SHQzXrEiDZddj4uHt9VnLGDi70ngIq67ERVC5wr7Zb+0wCKz4Xg3RynbLTDpuGRf2208I6Afwmp13PthIyWILHdU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=marliere.net; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=marliere.net header.i=@marliere.net header.b=A5izTxCP; arc=none smtp.client-ip=209.85.166.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=marliere.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marliere.net header.i=@marliere.net header.b="A5izTxCP" Received: by mail-il1-f177.google.com with SMTP id e9e14a558f8ab-365124888a5so13393275ab.1; Sat, 02 Mar 2024 09:06:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709399186; x=1710003986; h=cc:to:in-reply-to:references: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=KgdVXHvgkvHw4/0cMMKmouN9K55qBEYKyHuKSXuZy3E=; b=uZqhM6BBlahp6p3dPtN4fHxWoGYQthDwr4rm3v0H28vk0yEAH6KcpFPz4ZSsrHqi9c 1hpK0PYJb06FNkyRqNzkOvVqWyrh0GMta1qQe8PeTgoty6uq8cWzfDfHo3TEhqyinVXV MdLihk36E4nF4j7+Uis5nOkkZSHkitGpk1z57I4AFlRhG5GqZuYU8WEWAHHfMQ7Tfhsy beaNIM6DW34lu6rN9FuRJw9Hms+dJVWng14esbGOhDi5MlTzq7EPQHWGPedkGDrDn7Uo dwoutWqh7QgNdhzK7pljA4dvXOkR4P2ZVf9a0X2FZqU3u/UMeDr2JP8N/Iv/57r/Gzt5 JtYg== X-Forwarded-Encrypted: i=1; AJvYcCVFShziKS3AHiuCO3UHoPKUlTU5UknxgVXbJ1cowVeSIVkh2GDc75qOuq+Ju9olZru7aAjq2l2N9sOjUKP0pM0z7dEZPKMVXG1B7/WkdIaw/uWupRlUX3U2T95oM9QBIr5aosj9m3UvqwmpW55ATwseIgEmDUT+shMHuYMqtpWG X-Gm-Message-State: AOJu0YzDfTY/B1fIQcB2bBAbTltpoyBqSpgWHj5uUPYGJ6BTvtdF0PrY EvjXPYNe+lPWcHnE9gxj4ff7JcNZEmeNiQDQSqP0Qu1fdjosdc2v X-Google-Smtp-Source: AGHT+IGqScopIYaWExKYSKE+wXbOE4ju4s01FIFYrrZLOie5j2BAoAnFAHi0FszEsa42Zmj/K5hOVQ== X-Received: by 2002:a05:6e02:1446:b0:363:eb84:6510 with SMTP id p6-20020a056e02144600b00363eb846510mr7038861ilo.15.1709399185723; Sat, 02 Mar 2024 09:06:25 -0800 (PST) Received: from mail.marliere.net ([24.199.118.162]) by smtp.gmail.com with ESMTPSA id n12-20020a92dd0c000000b00365c96b8afesm1484366ilm.46.2024.03.02.09.06.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Mar 2024 09:06:25 -0800 (PST) From: "Ricardo B. Marliere" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marliere.net; s=2024; t=1709399184; 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: in-reply-to:in-reply-to:references:references; bh=KgdVXHvgkvHw4/0cMMKmouN9K55qBEYKyHuKSXuZy3E=; b=A5izTxCPQUMOvxjWUkAaRvAXXdEIIwB5dxIlFcQ6YN2UE2KhQWVZMVXVKlZ0xhTu84ab4t /NoqiWNJdJS1/y5uRbifqYZpzXaw8ovURpp4HUAiMFEYhNPEMWSC9cA6NEqxAOC2TLETi3 jtgsOCA20I6nDSV/GFYWd2coCI/dedQTsvX0r2rweqDAQhDWS2RZ12LEilRnNFXkQhs91a fd2nbRe6O9ghqWSe0rIOZ6A6Hu7r3iP1sM7zm1jCdvIV+JVN4rtLFz4ck8RlL7+4kYyVTX e8MDL8kA4O3+c2f8N7+kZVzHniT5oXKThcR3jUc21Xed1S0YF+3uOSZnZZTVYw== Authentication-Results: ORIGINATING; auth=pass smtp.auth=ricardo@marliere.net smtp.mailfrom=ricardo@marliere.net Date: Sat, 02 Mar 2024 14:06:02 -0300 Subject: [PATCH net-next 6/6] nfc: core: make nfc_class constant Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240302-class_cleanup-net-next-v1-6-8fa378595b93@marliere.net> References: <20240302-class_cleanup-net-next-v1-0-8fa378595b93@marliere.net> In-Reply-To: <20240302-class_cleanup-net-next-v1-0-8fa378595b93@marliere.net> To: Yisen Zhuang , Salil Mehta , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Loic Poulain , Sergey Ryazanov , Johannes Berg , Krzysztof Kozlowski Cc: Greg Kroah-Hartman , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-ppp@vger.kernel.org, "Ricardo B. Marliere" X-Developer-Signature: v=1; a=openpgp-sha256; l=1451; i=ricardo@marliere.net; h=from:subject:message-id; bh=RjXjt1NVx4j7b9346cDcfgKuL3rftAXS2K6j8XwIzlA=; b=owEBbQKS/ZANAwAKAckLinxjhlimAcsmYgBl41x7UljchVXqzzeheliAXHiwmVVPomgpjJ81B Qvxil2AGHyJAjMEAAEKAB0WIQQDCo6eQk7jwGVXh+HJC4p8Y4ZYpgUCZeNcewAKCRDJC4p8Y4ZY psBiEACloaR3I+KlMlQP6bdgs2Omb7gHKuCP7TLGBlE/H4h4c6nHlEl9tT4Wml40Texp3s2iIka wn9DNbFCqwCnSJbJyYaTttyw9udThAsNKjZcc2cR3n8oFi91dx4curJ3qAuMIx6UoIt5+bsqPV9 0cuBde+UueKdiHUGxZ2QepqLDY2EEloTTo0Hlc5GdPFi3ldnGdfpvnwB0XITNmqbV7lDshKLosf C5g11XgnlRvilsUW24l7UC2EJ2tmga1El/rjkA9L6I7rCE55i/H1dw7pismAsRiBMQQjqSoS2pw NzzWRMeSuQTUFktWLJsyH4ZyUoAtvnONmp15OM75dvba8DlhrCmbTZzkHxX7lr2MW1qRK/icanQ C6+yVM8Awrk2LG++Y1Rnj1vo+31ekHHCjSHHEqn8oIUCv9bSNWb20RPeutQYowXiu6O+jGIT8Rg /kgZ7SL0rvJD3xkqeHfUdPe/1Mpwy2gANfpHkPq0lALgSZ46ldc4rtDuGiUxQMH/XJKMEDrEErN jLOAzfT0pQcnLrFmHIHnfn012qKCDbc84X5zzC6VBqOtcTFtuhfTqilUSGhDTUGpsRJe5bUu+5x ds6p9uIE1kefmgHvz1k2MJz4BV+BhE9ih1X2DdXn/n+BcoiYyCxK1o6ntztJ4I2Jwvix05qCfRI wp3B4QTHeK0XJYw== X-Developer-Key: i=ricardo@marliere.net; a=openpgp; fpr=030A8E9E424EE3C0655787E1C90B8A7C638658A6 X-Patchwork-Delegate: kuba@kernel.org Since commit 43a7206b0963 ("driver core: class: make class_register() take a const *"), the driver core allows for struct class to be in read-only memory, so move the nfc_class structure to be declared at build time placing it into read-only memory, instead of having to be dynamically allocated at boot time. Cc: Greg Kroah-Hartman Suggested-by: Greg Kroah-Hartman Signed-off-by: Ricardo B. Marliere Reviewed-by: Simon Horman --- include/net/nfc/nfc.h | 2 +- net/nfc/core.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h index 5dee575fbe86..3d07abacf08b 100644 --- a/include/net/nfc/nfc.h +++ b/include/net/nfc/nfc.h @@ -196,7 +196,7 @@ struct nfc_dev { }; #define to_nfc_dev(_dev) container_of(_dev, struct nfc_dev, dev) -extern struct class nfc_class; +extern const struct class nfc_class; struct nfc_dev *nfc_allocate_device(const struct nfc_ops *ops, u32 supported_protocols, diff --git a/net/nfc/core.c b/net/nfc/core.c index eb2c0959e5b6..e58dc6405054 100644 --- a/net/nfc/core.c +++ b/net/nfc/core.c @@ -1015,7 +1015,7 @@ static void nfc_check_pres_timeout(struct timer_list *t) schedule_work(&dev->check_pres_work); } -struct class nfc_class = { +const struct class nfc_class = { .name = "nfc", .dev_release = nfc_release, };