Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2749725pxj; Mon, 10 May 2021 09:53:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxN0O8RoOkg0kWdjK+dwDU3vPZ7E3jBSkkK4TS6Lui9njODvrhs7iaPthSeeoNXNFay8mCA X-Received: by 2002:a05:6638:140e:: with SMTP id k14mr22104570jad.31.1620665596129; Mon, 10 May 2021 09:53:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620665596; cv=none; d=google.com; s=arc-20160816; b=xGBTEkPiPwS8SBxJ3VkTe/lNmv8qqr560fpqFKeB7S+DesiZfpfPZ2g/4jmRCEo+uC AVZNX46f6Hib3+7DBFS2k/dc8ktq07r5xDj2iUx2cxDQXdvWeQJTVwblMFixkabttacA A2BJtnKMWQfzVQdB46sybKMT/8rJfAi0+SBGeifOfNkHRKdvphjhlbFw4QAKgm0+TNhc cT8CwmhkR+8V1Eeq5cpX7p/4c/7HzwB1lkxBMA+nOqgcCcVCAOQB9esbwMZVMcwjTOfi z42spTLWqiasbPC2dwTa+H69LN1qtcEjvP/Z5qHDTeEkilwZcs10vCMzeMdZONt0/1PF Q+fg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uZpuZsNnCjySsgmzZqtgpp76pGdhukG2IhQjwLDkv+M=; b=rCdspFCT+GqmoRy4h6T/x6lbPSklIFYce9nmXUjoz6ma3vzJLsQUf9k8gVOh7a8RhL eFmqK/VsoWX7E6KGHinPvISWescWTplzhEtXjoKgmcVjVwPUaOykAhcFmi6byeXRn1qD fDlY9tJjOUAnBAnJck6cd5YsLgy/lYQ8oSeF0+A8tTVRuT6C5mpx0GBMQVqYQvzHP1cF iK0HiDJT+AYSMdG7BBv2zen8zKC7sgfs2F6lqBFXxTAkfhT2Jap3b/ppQsxOO8Q4jdW5 UmkF0R7c5KW7jF70Ttr+b2GOi7JJMs8TTSPy4+fYo3RdMTMH9d0z8ZsnmMF2J5FX+WF9 b0HQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LY6eILd+; 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=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i17si6631400ila.99.2021.05.10.09.53.03; Mon, 10 May 2021 09:53:16 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=LY6eILd+; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240195AbhEJL2o (ORCPT + 99 others); Mon, 10 May 2021 07:28:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:52744 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234696AbhEJK4x (ORCPT ); Mon, 10 May 2021 06:56:53 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5D985619AA; Mon, 10 May 2021 10:48:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620643702; bh=8LwezWZeE05J50OI6LLlm3L1WW2cgKZ/dH3ZJ+RR8dw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LY6eILd+voieQ4lOcafhNM9JM0O+D1uY+AK2S2rzzM9/ni7ssoows2X/StC2dDLkj olpaTugWFFGA1Wfnq0RaOieqTYCucMablrbbZ2730f7eLke5Ia0FHs+qVCy/xVqdRx 7rajGrX3atyekbdCZUZuciApSkiDcbf3RP/sqAw8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "David E. Box" , Hans de Goede , Rajneesh Bhardwaj , Sasha Levin Subject: [PATCH 5.11 123/342] platform/x86: intel_pmc_core: Dont use global pmcdev in quirks Date: Mon, 10 May 2021 12:18:33 +0200 Message-Id: <20210510102014.142659891@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102010.096403571@linuxfoundation.org> References: <20210510102010.096403571@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: David E. Box [ Upstream commit c9f86d6ca6b5e23d30d16ade4b9fff5b922a610a ] The DMI callbacks, used for quirks, currently access the PMC by getting the address a global pmc_dev struct. Instead, have the callbacks set a global quirk specific variable. In probe, after calling dmi_check_system(), pass pmc_dev to a function that will handle each quirk if its variable condition is met. This allows removing the global pmc_dev later. Signed-off-by: David E. Box Reviewed-by: Hans de Goede Reviewed-by: Rajneesh Bhardwaj Link: https://lore.kernel.org/r/20210417031252.3020837-2-david.e.box@linux.intel.com Signed-off-by: Hans de Goede Signed-off-by: Sasha Levin --- drivers/platform/x86/intel_pmc_core.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/platform/x86/intel_pmc_core.c b/drivers/platform/x86/intel_pmc_core.c index b5888aeb4bcf..260d49dca1ad 100644 --- a/drivers/platform/x86/intel_pmc_core.c +++ b/drivers/platform/x86/intel_pmc_core.c @@ -1186,9 +1186,15 @@ static const struct pci_device_id pmc_pci_ids[] = { * the platform BIOS enforces 24Mhz crystal to shutdown * before PMC can assert SLP_S0#. */ +static bool xtal_ignore; static int quirk_xtal_ignore(const struct dmi_system_id *id) { - struct pmc_dev *pmcdev = &pmc; + xtal_ignore = true; + return 0; +} + +static void pmc_core_xtal_ignore(struct pmc_dev *pmcdev) +{ u32 value; value = pmc_core_reg_read(pmcdev, pmcdev->map->pm_vric1_offset); @@ -1197,7 +1203,6 @@ static int quirk_xtal_ignore(const struct dmi_system_id *id) /* Low Voltage Mode Enable */ value &= ~SPT_PMC_VRIC1_SLPS0LVEN; pmc_core_reg_write(pmcdev, pmcdev->map->pm_vric1_offset, value); - return 0; } static const struct dmi_system_id pmc_core_dmi_table[] = { @@ -1212,6 +1217,14 @@ static const struct dmi_system_id pmc_core_dmi_table[] = { {} }; +static void pmc_core_do_dmi_quirks(struct pmc_dev *pmcdev) +{ + dmi_check_system(pmc_core_dmi_table); + + if (xtal_ignore) + pmc_core_xtal_ignore(pmcdev); +} + static int pmc_core_probe(struct platform_device *pdev) { static bool device_initialized; @@ -1253,7 +1266,7 @@ static int pmc_core_probe(struct platform_device *pdev) mutex_init(&pmcdev->lock); platform_set_drvdata(pdev, pmcdev); pmcdev->pmc_xram_read_bit = pmc_core_check_read_lock_bit(); - dmi_check_system(pmc_core_dmi_table); + pmc_core_do_dmi_quirks(pmcdev); /* * On TGL, due to a hardware limitation, the GBE LTR blocks PC10 when -- 2.30.2