Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1606259pxb; Thu, 4 Mar 2021 16:09:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJwHFAqZRjcofQdlWes038NqXOE4869zTi9MyHlKqyN/0LFpZ10tyNitQxYBOKD6cIHnR61B X-Received: by 2002:a05:6e02:2182:: with SMTP id j2mr6176732ila.5.1614902980275; Thu, 04 Mar 2021 16:09:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614902980; cv=none; d=google.com; s=arc-20160816; b=pHwuZ8ZULeS61VyaR9oYoNdLc9wvCKfyqcZ5YFv7rX2TQndQXevTirMy9iCfvUhHL8 Bwtz+GeiNDltgE+prf5RgY7HoTQ1I8qmaVeU0wyGMwJ9EdQs+jVDgBBaIGH5vU+opifM 7RxdoxRFKgKxxSI0JhYSCiWRINmH6qRLYEdHMj8ILeB7oHlKrmWNaMIjAUmQ9DxvTZia SGX264a+IYGQNYh78F1Lp8NqppsKfEamdXT2Lruuwunur5HWArRTwNTQjP1staQXN2ee oArrNRTbuHGt3UvnvxIiAt/Ei6Gau43rDlIVWwDGhoCULg+aJOK50brp//VP1hjUqww+ sRrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=W9jHcnwXDaxPMdEitaMFrpEp1sfjFYbFNwckX35HAk0=; b=lFeRZmfmq/11S5Tot/I2vVWLMTDLp9ER+0GWueD0LFmNQWVrVmAy147xus/5xJVlNE /Rg9nH7cKt6bM+6Q1fV42GjPoWMcHV4tcuijMPvkEBFfBYMR4UMSKYc+3tBFjHkK2tQF 1SMMYTu2by6j3r1ghaKsoMtYm47GBTCcN06R2noagKjKi415MJ/3oL+R+UHPIBhZDqTO Hu1USBtz8hx0SOOEK8gcTdfyexoWHUjXyIGBz3IIpz83WxFhiEF3sLoLf6tdCFCNy/tg K4TWjEHNkYmBkp3XI9rJr+JCYld1yMZs8cQlmiofEPaZ2y5tZs3X5HhhSlg1N/txz4Ae Y2Pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=FiN5D7CN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c1si803367jam.95.2021.03.04.16.09.27; Thu, 04 Mar 2021 16:09:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=FiN5D7CN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237998AbhCDJwD (ORCPT + 99 others); Thu, 4 Mar 2021 04:52:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237846AbhCDJvt (ORCPT ); Thu, 4 Mar 2021 04:51:49 -0500 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DB5AC061574; Thu, 4 Mar 2021 01:51:09 -0800 (PST) Received: by mail-pl1-x635.google.com with SMTP id d8so5410889plg.10; Thu, 04 Mar 2021 01:51:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=W9jHcnwXDaxPMdEitaMFrpEp1sfjFYbFNwckX35HAk0=; b=FiN5D7CN5Yd1lIwD4ahgeYb2Uy2hGkKGZ5EaGOhJfrlyhZ+eHlcTebcnzkgRe7r6ha D2/mBq/GXUbuYVAv9lK6utWBTpyF4Lbes0WMnXH8NyNZqgcAVaLJmCB/yCVG+QTEhZgj mwmTKSQucHq9VpEy42jFnM7j6Ymuytu21aMB3alT2iLoV6hFMTlRSXwZT+E2zDgkiMjT 3z/2DCTLBm82OtYXQjuK7feQ3Pkj18hhRWC9JplMZDYs9U/eTJMXd3dZfhGf3YCg2o+m lLeh6SY369KWM0rAmxWmMz02CKdiPnPz3yr0AaosK+K9nIR+HYDQgfT0jHGM30CezhqU agAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=W9jHcnwXDaxPMdEitaMFrpEp1sfjFYbFNwckX35HAk0=; b=HPcH446aeVbfu69a5SmroCGUbmMBcExxs4X6ExGucOT+BRf0yiu/kiTdQx37HKU9Vn jVAyJOt5C0QegxUp0zTjAAQEr52WgbbfKmbEdbNc09w3/8Xj+mY/2UsfNTxbqi7dkzeV WK2ybxcuFdWVqFm/vlWA8ALDzyadq6NOEvQ2sXZjov6Lg5fI6Rgmr/THG2fjtgq/xdhi WrhkPtVxDDcntzHlne9A4dqQK+4YgpWFjdT4U44fzRgWYfjK28Y0/UYW1CuvqpUQgZfm BFLEen3TQ+l/W2pwl8yUXDK3H7o+fEQJ/X83uC2vzJZfhDEKr+FicIbamcFfYl95xugw fsRg== X-Gm-Message-State: AOAM531ofb3tXZSmmKTq/kSZxZZATUKqoaBlaOpkWnWKgN6kNQIxH5Nj hIcebHvdj0D+lxqv7/TAh62+ubjhmxavh+pEo3s= X-Received: by 2002:a17:902:d2c1:b029:e5:ccfe:1e93 with SMTP id n1-20020a170902d2c1b02900e5ccfe1e93mr3176148plc.0.1614851468698; Thu, 04 Mar 2021 01:51:08 -0800 (PST) MIME-Version: 1.0 References: <20210302163309.25528-1-henning.schild@siemens.com> <20210302163309.25528-5-henning.schild@siemens.com> In-Reply-To: <20210302163309.25528-5-henning.schild@siemens.com> From: Andy Shevchenko Date: Thu, 4 Mar 2021 11:50:52 +0200 Message-ID: Subject: Re: [PATCH 4/4] platform/x86: pmc_atom: improve critclk_systems matching for Siemens PCs To: Henning Schild Cc: Linux Kernel Mailing List , Linux LED Subsystem , Platform Driver , linux-watchdog@vger.kernel.org, Srikanth Krishnakar , Jan Kiszka , Gerd Haeussler , Guenter Roeck , Wim Van Sebroeck , Mark Gross , Hans de Goede , Pavel Machek , Michael Haener Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 4, 2021 at 9:27 AM Henning Schild wrote: > Siemens industrial PCs unfortunately can not always be properly > identified the way we used to. An earlier commit introduced code that > allows proper identification without looking at DMI strings that could > differ based on product branding. > Switch over to that proper way and revert commits that used to collect > the machines based on unstable strings. > +#include > +static int pmc_clk_is_critical(const struct dmi_system_id *d) > +{ > + int ret = true; > + u32 station_id; > + > + if (!strcmp(d->ident, "SIEMENS AG")) { > + if (dmi_walk(simatic_ipc_find_dmi_entry_helper, &station_id)) > + ret = false; > + else > + ret = (station_id == SIMATIC_IPC_IPC227E || > + station_id == SIMATIC_IPC_IPC277E); > + } > + > + return ret; Much easier to rewrite it as if (strcmp(...)) // BTW, do we have a dmi_* helper for that? return true; if (dmi_walk) return false; return station_id == || ...; > +} Maybe instead you can rewrite it as a callback in DMI table which changes a (global, yeah) variable that you simply reassign... > if (d) { > - clk_data->critical = true; > - pr_info("%s critclks quirk enabled\n", d->ident); > + clk_data->critical = pmc_clk_is_critical(d); > + if (clk_data->critical) > + pr_info("%s critclks quirk enabled\n", d->ident); > } ...somewhere here? Like clk_data->critical = global_var; if (...) pr_info(); It seems it will reduce burden on a callback by dropping strcmp() call. -- With Best Regards, Andy Shevchenko