From patchwork Wed Mar 6 12:58:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Ellerman X-Patchwork-Id: 1908793 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ellerman.id.au header.i=@ellerman.id.au header.a=rsa-sha256 header.s=201909 header.b=ZoBxq3Yq; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=patchwork.ozlabs.org) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TqXZ61NXyz1yX4 for ; Wed, 6 Mar 2024 23:59:10 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ellerman.id.au header.i=@ellerman.id.au header.a=rsa-sha256 header.s=201909 header.b=ZoBxq3Yq; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4TqXZ55Tmpz3vYL for ; Wed, 6 Mar 2024 23:59:09 +1100 (AEDT) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ellerman.id.au header.i=@ellerman.id.au header.a=rsa-sha256 header.s=201909 header.b=ZoBxq3Yq; dkim-atps=neutral Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4TqXYr0Nxyz2ykt for ; Wed, 6 Mar 2024 23:58:56 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ellerman.id.au; s=201909; t=1709729935; bh=9RwCidLittcTSYA5I7tueyDJwlx4nsoQCHawsQpmFDo=; h=From:To:Subject:Date:From; b=ZoBxq3Yq2h4S+tEJXk39E0HvOQo+QS16H+MYBznEoRKb9j+3uvjM7WITyM+WoxyNO HGlbI4XthlgwpVPFOFR49SRps90XVvXO049iLTeFUnlahW32m/CoI0HvTOX0swlOHf YMXd3i1wleS5uZwhXBwk6bHpZ1VFl0BsEuGdP8nky5TWyQ6OXC4Cn6A8QF+ais58Dd iQTzzURSD8DD2UGzSBsMW4cCzv41hfBBvTQgeFMT1L+OgiD2BpIB9IMdv6YVcMoj+m tpMHHgnjJfMQd3yr9bbC+d0V1k/lNa69BasjFLCMAWBxSDXbk7lL4e5fzpouEoUtcp r2d65jnsAuWbQ== Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4TqXYq6C2nz4wcF; Wed, 6 Mar 2024 23:58:55 +1100 (AEDT) From: Michael Ellerman To: Subject: [PATCH 1/3] powerpc/64s: Fix get_hugepd_cache_index() build failure Date: Wed, 6 Mar 2024 23:58:51 +1100 Message-ID: <20240306125853.3714578-1-mpe@ellerman.id.au> X-Mailer: git-send-email 2.43.2 MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" With CONFIG_BUG=n, the 64-bit Book3S build fails with: arch/powerpc/include/asm/book3s/64/pgtable-64k.h: In function 'get_hugepd_cache_index': arch/powerpc/include/asm/book3s/64/pgtable-64k.h:51:1: error: no return statement in function returning non-void Currently the body of the function is just BUG(), so when CONFIG_BUG=n it is an empty function, leading to the error. get_hugepd_cache_index() should never be called, the only call is behind an is_hugepd() check, which is always false for this configuration. Instead mark it as always inline, and change the BUG() to BUILD_BUG(). That should allow the compiler to see that the function is never called, and therefore that it never returns, fixing the build error. Signed-off-by: Michael Ellerman --- arch/powerpc/include/asm/book3s/64/pgtable-64k.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/include/asm/book3s/64/pgtable-64k.h b/arch/powerpc/include/asm/book3s/64/pgtable-64k.h index 2fce3498b000..ced7ee8b42fc 100644 --- a/arch/powerpc/include/asm/book3s/64/pgtable-64k.h +++ b/arch/powerpc/include/asm/book3s/64/pgtable-64k.h @@ -45,9 +45,9 @@ static inline int hugepd_ok(hugepd_t hpd) /* * This should never get called */ -static inline int get_hugepd_cache_index(int index) +static __always_inline int get_hugepd_cache_index(int index) { - BUG(); + BUILD_BUG(); } #endif /* CONFIG_HUGETLB_PAGE */ From patchwork Wed Mar 6 12:58:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Ellerman X-Patchwork-Id: 1908794 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ellerman.id.au header.i=@ellerman.id.au header.a=rsa-sha256 header.s=201909 header.b=Goic8X+M; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=112.213.38.117; helo=lists.ozlabs.org; envelope-from=linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=patchwork.ozlabs.org) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TqXZt3pTfz1yX4 for ; Wed, 6 Mar 2024 23:59:50 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ellerman.id.au header.i=@ellerman.id.au header.a=rsa-sha256 header.s=201909 header.b=Goic8X+M; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4TqXZt2m21z3dXS for ; Wed, 6 Mar 2024 23:59:50 +1100 (AEDT) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ellerman.id.au header.i=@ellerman.id.au header.a=rsa-sha256 header.s=201909 header.b=Goic8X+M; dkim-atps=neutral Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4TqXYr3W5yz2ykt for ; Wed, 6 Mar 2024 23:58:56 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ellerman.id.au; s=201909; t=1709729936; bh=zTySiwWXK6HYutd6d53ZP8cANhuP0Xo5dmyGVJTtMb4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Goic8X+MMMmNleQRAeqitZIukY6/C0NG2deTW0ITTXDfU46DVgJdRb0/4Vgue7u1K dvU2R9C8bQMuchKs5kdCHuks5JsY5RalNYUmGl9eAqrr+D5YZD5MbVrGxjMO5atIMK m2Ynv5Y2DXDQ6U9/J06hMP0xlI3083nEhr6/ZKQ5Rq6AEvpKkxeMt60FgatwVlGYBV FpGv5mKfL8W6AbFONtAuyqSFs7zVnLLs0cjys5l7eK0l+j/rL/epzXgLtUogioisW6 /jyXvzA0N+g+5rMx5D3U6H3BMURJ8+m16w4BnQtXOSvp/DKf3xRXlKeB9U2DhSQLPK iBeTWRYcJeJ4g== Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4TqXYr2Jpmz4wcN; Wed, 6 Mar 2024 23:58:56 +1100 (AEDT) From: Michael Ellerman To: Subject: [PATCH 2/3] powerpc/83xx: Fix build failure with FPU=n Date: Wed, 6 Mar 2024 23:58:52 +1100 Message-ID: <20240306125853.3714578-2-mpe@ellerman.id.au> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240306125853.3714578-1-mpe@ellerman.id.au> References: <20240306125853.3714578-1-mpe@ellerman.id.au> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Building eg. 83xx/mpc832x_rdb_defconfig with FPU=n, fails with: arch/powerpc/platforms/83xx/suspend.c: In function 'mpc83xx_suspend_enter': arch/powerpc/platforms/83xx/suspend.c:209:17: error: implicit declaration of function 'enable_kernel_fp' 209 | enable_kernel_fp(); Fix it by providing an enable_kernel_fp() stub for FPU=n builds, which allows using IS_ENABLED(CONFIG_PPC_FPU) around the call to enable_kernel_fp(). Signed-off-by: Michael Ellerman --- arch/powerpc/include/asm/switch_to.h | 4 ++++ arch/powerpc/platforms/83xx/suspend.c | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/switch_to.h b/arch/powerpc/include/asm/switch_to.h index aee25e3ebf96..fc933807ddc8 100644 --- a/arch/powerpc/include/asm/switch_to.h +++ b/arch/powerpc/include/asm/switch_to.h @@ -48,6 +48,10 @@ static inline void disable_kernel_fp(void) #else static inline void save_fpu(struct task_struct *t) { } static inline void flush_fp_to_thread(struct task_struct *t) { } +static inline void enable_kernel_fp(void) +{ + BUILD_BUG(); +} #endif #ifdef CONFIG_ALTIVEC diff --git a/arch/powerpc/platforms/83xx/suspend.c b/arch/powerpc/platforms/83xx/suspend.c index c9664e46b03d..99bd4355f28e 100644 --- a/arch/powerpc/platforms/83xx/suspend.c +++ b/arch/powerpc/platforms/83xx/suspend.c @@ -206,7 +206,8 @@ static int mpc83xx_suspend_enter(suspend_state_t state) out_be32(&pmc_regs->config1, in_be32(&pmc_regs->config1) | PMCCR1_POWER_OFF); - enable_kernel_fp(); + if (IS_ENABLED(CONFIG_PPC_FPU)) + enable_kernel_fp(); mpc83xx_enter_deep_sleep(immrbase); From patchwork Wed Mar 6 12:58:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Ellerman X-Patchwork-Id: 1908795 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ellerman.id.au header.i=@ellerman.id.au header.a=rsa-sha256 header.s=201909 header.b=Dv+OjKxp; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=112.213.38.117; helo=lists.ozlabs.org; envelope-from=linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=patchwork.ozlabs.org) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TqXbj4RcJz1yX0 for ; Thu, 7 Mar 2024 00:00:33 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ellerman.id.au header.i=@ellerman.id.au header.a=rsa-sha256 header.s=201909 header.b=Dv+OjKxp; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4TqXbj22pqz3vdD for ; Thu, 7 Mar 2024 00:00:33 +1100 (AEDT) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ellerman.id.au header.i=@ellerman.id.au header.a=rsa-sha256 header.s=201909 header.b=Dv+OjKxp; dkim-atps=neutral Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4TqXYr6cTFz2ykt for ; Wed, 6 Mar 2024 23:58:56 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ellerman.id.au; s=201909; t=1709729936; bh=9HCPBoMCNUXsKBXM+ZdHQnglsx8sI0rEYyLYiTLALSI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Dv+OjKxptTxTLWPUqJL/pZmXSmxbvpqZJnyMxzyoDQvirxnLTekGGHV0qDwRC2aNo w0lj8lWnoW2fMSu+LwTLWB20yCDNZPepUxW9rqDHlHkMdN1nuJFxoXblpqGKmNBocL 9+zeKZ/BEY18i0c7lpWq5WvT8Oj0ihUqL9dka0aMOBptg7DNu2VAN9eX6t+kw4ASN9 tYTs2TBHhMWWsrmHF9ngA5+/QOVuPkBo80b49uUfYtYNQDINbBSLnOCVLZPSCXkEQ/ ZGq4LtMBxk3VlFS7qJ6QY8QXrHQjssAr2wUxjjjPgWem8EkhtZO7gJRTu/TQ7/UdQA Aj/nYZWZsnPhQ== Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4TqXYr5Rz3z4wqN; Wed, 6 Mar 2024 23:58:56 +1100 (AEDT) From: Michael Ellerman To: Subject: [PATCH 3/3] macintosh/ams: Fix unused variable warning Date: Wed, 6 Mar 2024 23:58:53 +1100 Message-ID: <20240306125853.3714578-3-mpe@ellerman.id.au> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240306125853.3714578-1-mpe@ellerman.id.au> References: <20240306125853.3714578-1-mpe@ellerman.id.au> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" If both CONFIG_SENSORS_AMS_PMU and CONFIG_SENSORS_AMS_I2C are unset, there is an unused variable warning in the ams driver: drivers/macintosh/ams/ams-core.c: In function 'ams_init': drivers/macintosh/ams/ams-core.c:181:29: warning: unused variable 'np' 181 | struct device_node *np; Fix it by using IS_ENABLED() to create a block for each case, and move the variable declartion in there. Probably the dependencies should be changed so that the driver can't be built with both variants disabled, but that would be a larger change. Signed-off-by: Michael Ellerman --- drivers/macintosh/ams/ams-core.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/drivers/macintosh/ams/ams-core.c b/drivers/macintosh/ams/ams-core.c index c978b4272daa..22d3e6605287 100644 --- a/drivers/macintosh/ams/ams-core.c +++ b/drivers/macintosh/ams/ams-core.c @@ -178,25 +178,24 @@ int ams_sensor_attach(void) static int __init ams_init(void) { - struct device_node *np; - spin_lock_init(&ams_info.irq_lock); mutex_init(&ams_info.lock); INIT_WORK(&ams_info.worker, ams_worker); -#ifdef CONFIG_SENSORS_AMS_I2C - np = of_find_node_by_name(NULL, "accelerometer"); - if (np && of_device_is_compatible(np, "AAPL,accelerometer_1")) - /* Found I2C motion sensor */ - return ams_i2c_init(np); -#endif - -#ifdef CONFIG_SENSORS_AMS_PMU - np = of_find_node_by_name(NULL, "sms"); - if (np && of_device_is_compatible(np, "sms")) - /* Found PMU motion sensor */ - return ams_pmu_init(np); -#endif + if (IS_ENABLED(CONFIG_SENSORS_AMS_I2C)) { + struct device_node *np = of_find_node_by_name(NULL, "accelerometer"); + if (np && of_device_is_compatible(np, "AAPL,accelerometer_1")) + /* Found I2C motion sensor */ + return ams_i2c_init(np); + } + + if (IS_ENABLED(CONFIG_SENSORS_AMS_PMU)) { + struct device_node *np = of_find_node_by_name(NULL, "sms"); + if (np && of_device_is_compatible(np, "sms")) + /* Found PMU motion sensor */ + return ams_pmu_init(np); + } + return -ENODEV; }