From patchwork Sat Aug 5 08:10:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jean Delvare X-Patchwork-Id: 131458 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp342720vqr; Sat, 5 Aug 2023 01:45:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHVjw03DNMq/yXjvJtnjvAwa8g3/idHlBdc5kMhCqzKetHiB9D4QMYorCmV4LQPzao8iadf X-Received: by 2002:a05:6a21:8184:b0:10f:1d33:d667 with SMTP id pd4-20020a056a21818400b0010f1d33d667mr4423526pzb.5.1691225119579; Sat, 05 Aug 2023 01:45:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691225119; cv=none; d=google.com; s=arc-20160816; b=PlIftQcfAIfSt8Ul1FVXeG9qgElT6XoQ/YDEG5LrVCovIMHejOshlQqpOalmIZaDQv H5/CXFNFWSjKx3h+XctfCMf/HpLQprhIaeWRe2PddQCBHIqFqciQ6SScyNbqrKr+gizp zGOE8yIQQMUZeJlZFtl3X/z2YB77w6zN2Zov4IjDiAWgz/SDMvqZeUoEFspXIKCTApWy /lAcVS1FRKRu9SHBKFQpZifdf0eNFAI7qXQ13phauwX2/JMTAjzFjgcmPWoT6dVW7HDq jRTGrwkKJMK4gJUZtGqWpHn6x6rK7sucS18V3qq7MWd9h15ADFTHEyw+YD/+kHDX00wA vx5w== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w23-20020a639357000000b00564b8e55214si1279747pgm.385.2023.08.05.01.45.05; Sat, 05 Aug 2023 01:45:19 -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 S229870AbjHEIKS (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 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773378070729848122 X-GMAIL-MSGID: 1773378070729848122 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 constant { SM_ECO_NAME, 0xc2 }, ^~~~~~~~~~~ drivers/platform/x86/msi-ec.c:72:6: note: (near initialization for ‘CONF0.shift_mode.modes[0].name’) drivers/platform/x86/msi-ec.c:73:6: error: initializer element is not constant { SM_COMFORT_NAME, 0xc1 }, ^~~~~~~~~~~~~~~ drivers/platform/x86/msi-ec.c:73:6: note: (near initialization for ‘CONF0.shift_mode.modes[1].name’) drivers/platform/x86/msi-ec.c:74:6: error: initializer element is not constant { SM_SPORT_NAME, 0xc0 }, ^~~~~~~~~~~~~ drivers/platform/x86/msi-ec.c:74:6: note: (near initialization for ‘CONF0.shift_mode.modes[2].name’) (...) 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 -static const char *const SM_ECO_NAME = "eco"; -static const char *const SM_COMFORT_NAME = "comfort"; -static const char *const SM_SPORT_NAME = "sport"; -static const char *const SM_TURBO_NAME = "turbo"; +#define SM_ECO_NAME "eco" +#define SM_COMFORT_NAME "comfort" +#define SM_SPORT_NAME "sport" +#define SM_TURBO_NAME "turbo" -static const char *const FM_AUTO_NAME = "auto"; -static const char *const FM_SILENT_NAME = "silent"; -static const char *const FM_BASIC_NAME = "basic"; -static const char *const FM_ADVANCED_NAME = "advanced"; +#define FM_AUTO_NAME "auto" +#define FM_SILENT_NAME "silent" +#define FM_BASIC_NAME "basic" +#define FM_ADVANCED_NAME "advanced" static const char * const ALLOWED_FW_0[] __initconst = { "14C1EMS1.012",