From patchwork Wed Jan 11 11:30:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 1724613 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=2404:9400:2221:ea00::3; helo=gandalf.ozlabs.org; envelope-from=srs0=fdi1=5i=vger.kernel.org=sparclinux-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=r2G5tc8B; dkim-atps=neutral Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NsQWR5z65z23f3 for ; Wed, 11 Jan 2023 22:32:03 +1100 (AEDT) Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4NsQWQ6z7vz4xyL for ; Wed, 11 Jan 2023 22:32:02 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4NsQWQ6wn5z4xyP; Wed, 11 Jan 2023 22:32:02 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=sparclinux-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=r2G5tc8B; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4NsQWQ6rFNz4xyL for ; Wed, 11 Jan 2023 22:32:02 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236583AbjAKLcA (ORCPT ); Wed, 11 Jan 2023 06:32:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234084AbjAKLb3 (ORCPT ); Wed, 11 Jan 2023 06:31:29 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26537959F; Wed, 11 Jan 2023 03:31:24 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D7F8BB81B8D; Wed, 11 Jan 2023 11:31:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D567C433D2; Wed, 11 Jan 2023 11:31:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1673436681; bh=0Bpc3jZjc4ubxRXEsKaSqd4DQvO/82q+vPfR3P3xTaU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r2G5tc8BY8ykHRTD/OsbadLcY1VbAKeAdi6TlC8+3y+LG0eFIpUqlRNPaXjhniqDL ofcdXdlfExzRc5T+fiT8Xz3RLG5A4DfqZyKr1Zs88N17J/jZVrA+gpAkuOLjqrU5tj MpXeAEjbSL302ItcLZrQgjNIM4x0MVe9LfV8AhMI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Michael Ellerman , Nicholas Piggin , Christophe Leroy , "David S. Miller" , "Gustavo A. R. Silva" , Kees Cook , linuxppc-dev@lists.ozlabs.org, sparclinux@vger.kernel.org Subject: [PATCH v2 08/16] vio: move to_vio_dev() to use container_of_const() Date: Wed, 11 Jan 2023 12:30:10 +0100 Message-Id: <20230111113018.459199-9-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230111113018.459199-1-gregkh@linuxfoundation.org> References: <20230111113018.459199-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2143; i=gregkh@linuxfoundation.org; h=from:subject; bh=0Bpc3jZjc4ubxRXEsKaSqd4DQvO/82q+vPfR3P3xTaU=; b=owGbwMvMwCRo6H6F97bub03G02pJDMn75p64zvshJ7oi+c3+BtE+i8Apuy+b/guyP3N4Tu78wtP/ ciJtO2JZGASZGGTFFFm+bOM5ur/ikKKXoe1pmDmsTCBDGLg4BWAi1VsY5mfKqPws5+bR2mlWnO3iE2 ykzmb3jGGuqNfd0JrDl5b/V425UlEbUj9xSdYrAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: sparclinux@vger.kernel.org The driver core is changing to pass some pointers as const, so move to_vio_dev() to use container_of_const() to handle this change. to_vio_dev() now properly keeps the const-ness of the pointer passed into it, while as before it could be lost. Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Christophe Leroy Cc: "David S. Miller" Cc: "Gustavo A. R. Silva" Cc: Kees Cook Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org Cc: sparclinux@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/include/asm/vio.h | 5 +---- arch/sparc/include/asm/vio.h | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/include/asm/vio.h b/arch/powerpc/include/asm/vio.h index e7479a4abf96..cc9b787627ad 100644 --- a/arch/powerpc/include/asm/vio.h +++ b/arch/powerpc/include/asm/vio.h @@ -161,10 +161,7 @@ static inline struct vio_driver *to_vio_driver(struct device_driver *drv) return container_of(drv, struct vio_driver, driver); } -static inline struct vio_dev *to_vio_dev(struct device *dev) -{ - return container_of(dev, struct vio_dev, dev); -} +#define to_vio_dev(__dev) container_of_const(__dev, struct vio_dev, dev) #endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_VIO_H */ diff --git a/arch/sparc/include/asm/vio.h b/arch/sparc/include/asm/vio.h index 2d7bdf665fd3..8a0c3c11c9ce 100644 --- a/arch/sparc/include/asm/vio.h +++ b/arch/sparc/include/asm/vio.h @@ -488,10 +488,7 @@ static inline struct vio_driver *to_vio_driver(struct device_driver *drv) return container_of(drv, struct vio_driver, driver); } -static inline struct vio_dev *to_vio_dev(struct device *dev) -{ - return container_of(dev, struct vio_dev, dev); -} +#define to_vio_dev(__dev) container_of_const(__dev, struct vio_dev, dev) int vio_ldc_send(struct vio_driver_state *vio, void *data, int len); void vio_link_state_change(struct vio_driver_state *vio, int event);