Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp845963rwb; Sat, 5 Aug 2023 02:09:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHqbK3t3io3UT1XzR1mPs+MJl3m4vJDJJYWWlD7A4KpKRuXReX7iNbfSd0TFt5i0iAcodXR X-Received: by 2002:a17:902:e549:b0:1bc:28a8:f856 with SMTP id n9-20020a170902e54900b001bc28a8f856mr5415774plf.47.1691226581863; Sat, 05 Aug 2023 02:09:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691226581; cv=none; d=google.com; s=arc-20160816; b=pq8cnz5PjVkqUHuNJTYmS5JU4TrtGU0UaoIhDCWh0dSPJIQW1QaDUcDJTpmVtguVFY ZtNwQqy9Taek4nhs/Ld6lJm69Y/8KBu+HaVNwMQOlITvAAQArL/GVi4Zbd2aJ4eFy+2P Utji3jFHO5zPXjD0gpDBXk4y76zTHSlSasmFVjGQGGp87PcW0MWgTTYkohXJM8ocT6gU QWG89mfFXJB88lCt0xwxyCMBrrkSAKJP7UuwqF6pER362+vJI/hminTEzTRKBkwhl0su QgfSwxPUQsYZskQnEZnDMCfeDWwyaKOoY9My/q7uHU1y2QPSR2l6oNtroX8mjec4aJfd tnlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=Rc19v92ZKafrhVQKT2HLoHZy05f/qnyul6RyA91HupU=; fh=BxnSsM0vG4qKA/KEdKDeGyGjnTPGn4hi85+1NVzxRg8=; b=M8E/GCeXJqmCz5gcygBxf4338+xyTR0BeRCHdO4ps8zubSG1waNxs4t0O2kEo2tyQ2 D+DTCldabkJ0HRyyJiKJnua8o+zEAREepCYjFKKJye2QT3zOI5GDSaE+t26K4VM7gQ++ 3swQ8f6Rj2DuuMRGSQP3iGUSncHALs2VTtxtAJ2+Sigbmr5BwfU2LfM7FsLcqoiTEOlN oj77Y9YSmUQX4eGpcqxpnVCJ2S0UmpBJb9hA67wpnhaX/UY3naFmAve08LvCCyTIKXfL mtoyA/1lRnVB8uUjOhnh5E9O03hM1xzFy0Wxc3XZDFdlRUmmXS8y9Qsg9V0eFdEv5P7x qXWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=B6KiFOWH; dkim=neutral (no key) header.i=@suse.de header.b="Dj/Fr446"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a62-20020a639041000000b00564bf4a5e83si2174636pge.178.2023.08.05.02.09.30; Sat, 05 Aug 2023 02:09:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=B6KiFOWH; dkim=neutral (no key) header.i=@suse.de header.b="Dj/Fr446"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229863AbjHEIKS (ORCPT + 99 others); Sat, 5 Aug 2023 04:10:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229460AbjHEIKR (ORCPT ); Sat, 5 Aug 2023 04:10:17 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BA8010C4; Sat, 5 Aug 2023 01:10:14 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id CD27521850; Sat, 5 Aug 2023 08:10:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1691223012; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Rc19v92ZKafrhVQKT2HLoHZy05f/qnyul6RyA91HupU=; b=B6KiFOWHoOIn5u1j98c+r7UwASnbrsREC4fVUPsApdI2L4eB33gNQo6ScfEsDvSUuCOIVx np2c4OX5c8AuRm1RM2Qbb9WgRS9lMsaXBZtQGPL/cDSh3J52sKttCzfADK7R1WKDX2rBrr I7U6xkQvI5bwzebbFO+UdGVGGbEJ4wM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1691223012; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Rc19v92ZKafrhVQKT2HLoHZy05f/qnyul6RyA91HupU=; b=Dj/Fr446/aTkfAy501dU9GiOzgjCwpDuN0K+hG10rP/YnhgT2FtNjw2ux7aCxIp3IQnPcr AkmBM6gAzy7i8RBA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 9C520139BC; Sat, 5 Aug 2023 08:10:12 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id UahEJOQDzmRCNAAAMHmgww (envelope-from ); Sat, 05 Aug 2023 08:10:12 +0000 Date: Sat, 5 Aug 2023 10:10:10 +0200 From: Jean Delvare To: platform-driver-x86@vger.kernel.org Cc: LKML , Nikita@imap2.suse-dmz.suse.de, "Kravets , Mark Gross Subject: [PATCH] platform/x86: msi-ec: Fix the build Message-ID: <20230805101010.54d49e91@endymion.delvare> Organization: SUSE Linux X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.34; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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: linux-kernel@vger.kernel.org The msi-ec driver fails to build for me (gcc 7.5): CC [M] drivers/platform/x86/msi-ec.o drivers/platform/x86/msi-ec.c:72:6: error: initializer element is not const= ant { SM_ECO_NAME, 0xc2 }, ^~~~~~~~~~~ drivers/platform/x86/msi-ec.c:72:6: note: (near initialization for =E2=80= =98CONF0.shift_mode.modes[0].name=E2=80=99) drivers/platform/x86/msi-ec.c:73:6: error: initializer element is not const= ant { SM_COMFORT_NAME, 0xc1 }, ^~~~~~~~~~~~~~~ drivers/platform/x86/msi-ec.c:73:6: note: (near initialization for =E2=80= =98CONF0.shift_mode.modes[1].name=E2=80=99) drivers/platform/x86/msi-ec.c:74:6: error: initializer element is not const= ant { SM_SPORT_NAME, 0xc0 }, ^~~~~~~~~~~~~ drivers/platform/x86/msi-ec.c:74:6: note: (near initialization for =E2=80= =98CONF0.shift_mode.modes[2].name=E2=80=99) (...) Don't try to be smart, just use defines for the constant strings. The compiler will recognize it's the same string and will store it only once in the data section anyway. Signed-off-by: Jean Delvare Fixes: 392cacf2aa10 ("platform/x86: Add new msi-ec driver") Cc: stable@vger.kernel.org Cc: Nikita Kravets Cc: Hans de Goede Cc: Mark Gross --- drivers/platform/x86/msi-ec.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) --- linux-6.4.orig/drivers/platform/x86/msi-ec.c +++ linux-6.4/drivers/platform/x86/msi-ec.c @@ -27,15 +27,15 @@ #include #include =20 -static const char *const SM_ECO_NAME =3D "eco"; -static const char *const SM_COMFORT_NAME =3D "comfort"; -static const char *const SM_SPORT_NAME =3D "sport"; -static const char *const SM_TURBO_NAME =3D "turbo"; +#define SM_ECO_NAME "eco" +#define SM_COMFORT_NAME "comfort" +#define SM_SPORT_NAME "sport" +#define SM_TURBO_NAME "turbo" =20 -static const char *const FM_AUTO_NAME =3D "auto"; -static const char *const FM_SILENT_NAME =3D "silent"; -static const char *const FM_BASIC_NAME =3D "basic"; -static const char *const FM_ADVANCED_NAME =3D "advanced"; +#define FM_AUTO_NAME "auto" +#define FM_SILENT_NAME "silent" +#define FM_BASIC_NAME "basic" +#define FM_ADVANCED_NAME "advanced" =20 static const char * const ALLOWED_FW_0[] __initconst =3D { "14C1EMS1.012", --=20 Jean Delvare SUSE L3 Support