Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2662391rwl; Sat, 1 Apr 2023 11:53:34 -0700 (PDT) X-Google-Smtp-Source: AKy350YvTsWIHcAyS/q2dHKBvO1XPchBolU9Sflk7+2ovpFHkomoPQT+3TTEid03w9ycTlt98wN5 X-Received: by 2002:a05:6a20:2156:b0:e3:763e:555 with SMTP id z22-20020a056a20215600b000e3763e0555mr10417457pzz.57.1680375214586; Sat, 01 Apr 2023 11:53:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680375214; cv=none; d=google.com; s=arc-20160816; b=j65NebwJ4GN3BleveRaRI1IAVshMGYMvzkm7JlMhB0cfPQiJvl+dqKqaWnUXdSHnlX tze4ShfEkUQ+hT8jfHHQ1gAJNIlbevdNwm8QNbzo+wdpP0uQxR8C97dn+EDpDB90Y8G+ qssgAdRCRkyzIrDT4riXb9Kqiv2l1r8CP1122UtqAj9ic6wJNLvlPYs89f7QX1yW1xD0 cIfeGzBPvsaIz9HGYGq+RBd5gOrSGLUsDh1WwDqnAqEl9upMQlw85MZtG2+mEmymajl7 6ehRw42ALX0jKGLcrRNl9ZDrkOnpnLdk8DW91VocrFuV4hYXt/sng2zr+waRjcRpV45Q 1tag== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :feedback-id:dkim-signature:dkim-signature; bh=EgK3/TiL28np4Zgt5b+Y1BW3uvD4i1QZBW4nZflddTo=; b=zbbAp3zwzlETQMn9jBphYJpVwNn+liF0tnvmwaliBuiZGlBYRXjtMSxVYxJyB+75uI /N2mY0XWHSlqHgFBeOBQsoJiNSr875t/4uJ1T1kI4g9A+X5gaesP2UuDvvL2HbMUFvnw RE55/yJrNBEP3FXmEibb3n6mUeGz8S5EakQDzgyqw1iqgFMXaUX9GoM2JKweol9Pkkxq Kcl/w2oD+/q5gbQxWy7qCZuQpx/78Nx0lXFZX/wMfs8b9eseANSSSu5ExM/i+q+SwsE3 Mb9y6wRBJfq+BZxTBhqzeMZCeBFASf1sK1gtKoTrZHfVy0hwPVqqCDgkXvW/OHuYYv3E qc4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@squebb.ca header.s=fm3 header.b="kQlG/2aT"; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=MAmzMeNO; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 11-20020a63030b000000b004fb97a4c536si5110550pgd.873.2023.04.01.11.53.20; Sat, 01 Apr 2023 11:53:34 -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=@squebb.ca header.s=fm3 header.b="kQlG/2aT"; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=MAmzMeNO; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229849AbjDASoF (ORCPT + 99 others); Sat, 1 Apr 2023 14:44:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229791AbjDASoD (ORCPT ); Sat, 1 Apr 2023 14:44:03 -0400 Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8612076A2; Sat, 1 Apr 2023 11:44:02 -0700 (PDT) Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id 701673200929; Sat, 1 Apr 2023 14:44:01 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Sat, 01 Apr 2023 14:44:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=squebb.ca; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1680374641; x= 1680461041; bh=EgK3/TiL28np4Zgt5b+Y1BW3uvD4i1QZBW4nZflddTo=; b=k QlG/2aT3s3N+UkoOxW1j7vt1fNMnAgu7Pt8zM/HOM4cWHcmGsL6SNtZKo7wQBgEU birN6Gb9kDI0bgLK31lolyhU1UZVtKouLdV6rncBByUIydGJ28EEhrWEyQTTjWz0 glxH89hQ/Cwl4/sUWScMNhoZN3CaWI8uEj8GdzwSIDIgTvQMprpmA1E2iqy82bu+ nyUNng6kcB8RjTddFOgfpgSPF8DYJkcyMXEflUHkPnsmUl+kz+dMeyalNj1xwXme q/3dW2sCNpApPzDV6BCai9PBClIsubvLiL6L/rKxq/KVhUD4LWr5ECaMU4c31xKn ybPL1YS1CYySaTlRqcR8g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1680374641; x= 1680461041; bh=EgK3/TiL28np4Zgt5b+Y1BW3uvD4i1QZBW4nZflddTo=; b=M AmzMeNOTkPgjPgbXr1AbBhOg1cHpu4AsuWlsUx58XwYKNoT8ktHqrBSfY4lRLlkp K23w3XAJ2m8xBgkNxMF8/xlPPDrhTZbHe2W9JGQD7CCVD33xwnzVNslWrskX2EpB vmWM7QQqaliZhy95aVAnAejPqO+f7z2ZOO+daF5ey+MK7/y48b82o/qUG2HvIGtx OYIlcrkf7wuqCH827NsYRjxzT93Myt/0Jb1UrrOYa2JiQ7PmcR0cVXsFf+gePM0w zVD2bAKNPf9Bw5Eh2lL4BxorFxOAIrhHHGaxxbFPDqY+myFUogjPkrCaKIP6Cm89 hnpkhegBGii2sjQut5Dhg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdeifedguddvkecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecuogetfedtuddqtdduucdludehmdenucfjughrpe fhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforghrkhcurfgvrghr shhonhcuoehmphgvrghrshhonhdqlhgvnhhovhhosehsqhhuvggssgdrtggrqeenucggtf frrghtthgvrhhnpeekfeduueetuddtgeehjefhvdeiheejhfelfefgvedtiedvhfelheei udefgeffkeenucffohhmrghinhepghhithhhuhgsrdgtohhmnecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmhhpvggrrhhsohhnqdhlvghnohhv ohesshhquhgvsggsrdgtrg X-ME-Proxy: Feedback-ID: ibe194615:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 1 Apr 2023 14:44:00 -0400 (EDT) From: Mark Pearson To: mpearson-lenovo@squebb.ca Cc: hdegoede@redhat.com, markgross@kernel.org, W_Armin@gmx.de, mirsad.todorovac@alu.unizg.hr, linux@weissschuh.net, Mario.Limonciello@amd.com, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] platform/x86: think-lmi: Clean up display of current_value on Thinkstation Date: Sat, 1 Apr 2023 14:43:45 -0400 Message-Id: <20230401184345.208960-2-mpearson-lenovo@squebb.ca> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230401184345.208960-1-mpearson-lenovo@squebb.ca> References: <20230401184345.208960-1-mpearson-lenovo@squebb.ca> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS autolearn=unavailable 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 On ThinkStations on retrieving the attribute value the BIOS appends the possible values to the string. Clean up the display in the current_value_show function so the options part is not displayed. Fixes: a40cd7ef22fb ("platform/x86: think-lmi: Add WMI interface support on Lenovo platforms") Reported by Mario Limoncello Link: https://github.com/fwupd/fwupd/issues/5077#issuecomment-1488730526 Signed-off-by: Mark Pearson --- drivers/platform/x86/think-lmi.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c index ad952b49617b..29e94db03238 100644 --- a/drivers/platform/x86/think-lmi.c +++ b/drivers/platform/x86/think-lmi.c @@ -920,7 +920,7 @@ static ssize_t display_name_show(struct kobject *kobj, struct kobj_attribute *at static ssize_t current_value_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { struct tlmi_attr_setting *setting = to_tlmi_attr_setting(kobj); - char *item, *value; + char *item, *value, *p; int ret; ret = tlmi_setting(setting->index, &item, LENOVO_BIOS_SETTING_GUID); @@ -931,11 +931,13 @@ static ssize_t current_value_show(struct kobject *kobj, struct kobj_attribute *a value = strpbrk(item, ","); if (!value || value == item || !strlen(value + 1)) ret = -EINVAL; - else - ret = sysfs_emit(buf, "%s\n", value + 1); - + else { + /* On Workstations remove the Options part after the value */ + p = strchrnul(value, ';'); + *p = '\0'; + ret = sysfs_emit(buf, "%s\n", value + 1); + } kfree(item); - return ret; } -- 2.39.2