From nobody Mon Sep 15 19:44:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8EB1CC5479D for ; Wed, 11 Jan 2023 11:31:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233219AbjAKLbi (ORCPT ); Wed, 11 Jan 2023 06:31:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232316AbjAKLaj (ORCPT ); Wed, 11 Jan 2023 06:30:39 -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 E4D5B95B3; Wed, 11 Jan 2023 03:30:37 -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 8E7E9B81B8D; Wed, 11 Jan 2023 11:30:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D55ADC433EF; Wed, 11 Jan 2023 11:30:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1673436635; bh=n8OnoHXUKt8/vexOA9DOw2P/znFEmBc1dMUhPM/P1nE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2sy49pouXHeFMASqr063ewfQj/lTX3SXAOjasByVHYZhWJtGQf+RQpeHziZY54PeY JXq+p19tkWKhMMWJx/E/kp6W25ZORCcL6ZjLRYaGln7pPm8n61zZDJYS4UjHnpI6PH Zz4N6jXJRlr1PtNp9rX+/FZOhZkDRoyUJupRvbEM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , linux-hyperv@vger.kernel.org Subject: [PATCH v2 10/16] drivers: hv: move device_to_hv_device to use container_of_const() Date: Wed, 11 Jan 2023 12:30:12 +0100 Message-Id: <20230111113018.459199-11-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=1177; i=gregkh@linuxfoundation.org; h=from:subject; bh=n8OnoHXUKt8/vexOA9DOw2P/znFEmBc1dMUhPM/P1nE=; b=owGbwMvMwCRo6H6F97bub03G02pJDMn75p68dtJ97m/PZ6YrTvN9j4tZYrzO51pEfViqqM8V7m6l c1nnO2JZGASZGGTFFFm+bOM5ur/ikKKXoe1pmDmsTCBDGLg4BWAiN+4zzHd07zprkHDlNOMpv//hrd tW83MGBTEs2BxmsuBRzpwd6/jnMYrpL0sXlnjlCAA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The driver core is changing to pass some pointers as const, so move device_to_hv_device() to use container_of_const() to handle this change. device_to_hv_device() now properly keeps the const-ness of the pointer passed into it, while as before it could be lost. Cc: "K. Y. Srinivasan" Cc: Haiyang Zhang Cc: Wei Liu Cc: Dexuan Cui Cc: linux-hyperv@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Greg Kroah-Hartman Acked-by: Wei Liu --- include/linux/hyperv.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index 85f7c5a63aa6..8430e27f3c3f 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h @@ -1309,10 +1309,7 @@ struct hv_device { }; =20 =20 -static inline struct hv_device *device_to_hv_device(struct device *d) -{ - return container_of(d, struct hv_device, device); -} +#define device_to_hv_device(d) container_of_const(d, struct hv_device, dev= ice) =20 static inline struct hv_driver *drv_to_hv_drv(struct device_driver *d) { --=20 2.39.0