Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp3110373lqo; Tue, 14 May 2024 22:57:31 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU1/qxUTwIg9QFCZScWGOs7xGQ0NoMhhNvWLEqYe4ismMTTiu+8GWCTcigW6i/ckES1xPJ5y8I66lTvNzpWqQX+jIj0T3wcak4wqV8RCA== X-Google-Smtp-Source: AGHT+IFOz0fmIy0253MCWNLE0DsP6qE3LO4W7I7idxGdAhDyEGX8ClmhPZNDn/yAMzWf03izTLKA X-Received: by 2002:a05:6358:7204:b0:192:8935:4067 with SMTP id e5c5f4694b2df-193bb612b4fmr1831596555d.14.1715752650682; Tue, 14 May 2024 22:57:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715752650; cv=pass; d=google.com; s=arc-20160816; b=UmrMcKtA9nuJ6SRgDljN7FSWgNrac68eRDxKF8QJO6Fp8XEc8xJNUuep86GlSeJyYC WqnqZ7IA6ItWJ0ZRZvwaOJ/+V+JS/9TGeium4+WRI0LLbzkfpoH3SsFPhSTkau9k4hcC zu2ol2RfRK1bfHz82ZEk2Cb6D4uTSJOWVIJPoPfJPHdMkbuuzPmhKycdEGFetKth7gHt qqZ3EXr2T0SivWihGT/C8MYHL4Hg+oxbLFiGSvVES3XDgZsAs1WK5lBZvAGeZHWXAvAH eaG+eP6VN64WcI6bDX9Ot1Dq6ZaBWKvpE6MX54GuFo4aWeKM/4O6k0sgIQJq8hpxSiUp 7Gmg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=VoL3zK3L1j4stcNJ2+pIA/oRroKbL5dxiIbE/+qQ8c8=; fh=TB40nJxdONdf4WtVAnDt8DWbDrzJeBBXgHK/mPL12mo=; b=kSAtJGFuJ6Qg6aZi/LxT1VG3TivAdkTFuJrslK5615MvloFghvgf/mJvv4BBYD0EKT h35DeT6vnNfoWVB1cswbM0uVho/o8mMjg44G9M3lTKLs1g8AIZPM3n8e90YPGSQ5Cp6u qduUd4C0/+pLXHAdn0RIbQLledftoSZaJeemik+0Jgwp7w9xlAO418fp2mxbLGL+duv+ oQK0CtGUnC/plU5X4g0fc1wFIKzOkCQTyIETG7NQW5zx0k9jMEsT39ub3/tKNnbLmJHV SKDMXS5oeaMGIgAnnmUIClN6Qw5av6AQAf2pOoRrgCRBkMqK/On2cIeShT+5/m15wx9D +2YQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@jubnut.com header.s=MBO0001 header.b=Z4gXrivh; arc=pass (i=1 spf=pass spfdomain=jubnut.com dkim=pass dkdomain=jubnut.com dmarc=pass fromdomain=jubnut.com); spf=pass (google.com: domain of linux-kernel+bounces-179482-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179482-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=jubnut.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-634101184dasi12519346a12.287.2024.05.14.22.57.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 May 2024 22:57:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-179482-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@jubnut.com header.s=MBO0001 header.b=Z4gXrivh; arc=pass (i=1 spf=pass spfdomain=jubnut.com dkim=pass dkdomain=jubnut.com dmarc=pass fromdomain=jubnut.com); spf=pass (google.com: domain of linux-kernel+bounces-179482-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179482-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=jubnut.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 1D2552827C6 for ; Wed, 15 May 2024 05:57:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F38D93F9EC; Wed, 15 May 2024 05:56:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=jubnut.com header.i=@jubnut.com header.b="Z4gXrivh" Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8CA2D3BBEF for ; Wed, 15 May 2024 05:56:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.241.56.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715752610; cv=none; b=C6LQCMgmbUXC5wQRkt5wpextgDtfGlnnn0OyhWism4Mq0tI1UKB3pkbDUHJe1wEFPKA83yEM1npIHn5COlnQUG8RMgEfIvJxszQXBWzn8AWiK6BguJzq4zMI+gxNLuAnql1GZ6BUcH5wgidAGgjBB3Ozrv4F4NbXiDMM8RRTYyk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715752610; c=relaxed/simple; bh=x0Ce6SNi7t9wumEB4tfAmXukeqbDL2EpNciA2Omy+sI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lAoscJ6KHoZ62rABfHOVz29Gsd5mM0ZaM/OiGNR37R/QtVLZBW6oH6vM4Gaf6dLrSDwYtc2WkPjw7OBbETA0vojPVCsQzJDDCm63Nc0iUlfEKcW3fc+zxKb1B3PQ8rg1gfwbgGlh3GjzggMz80hwcCtT3fcv0qfmVslNDHhKynw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=jubnut.com; spf=pass smtp.mailfrom=jubnut.com; dkim=pass (2048-bit key) header.d=jubnut.com header.i=@jubnut.com header.b=Z4gXrivh; arc=none smtp.client-ip=80.241.56.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=jubnut.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=jubnut.com Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:b231:465::202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4VfMtK468Qz9srm; Wed, 15 May 2024 07:56:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jubnut.com; s=MBO0001; t=1715752601; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VoL3zK3L1j4stcNJ2+pIA/oRroKbL5dxiIbE/+qQ8c8=; b=Z4gXrivhuTI1CBryzUlYqeX8xAFA1Ab2JDOcV+EYzO5NmhvmdVBr7DW/ouIQkMtVXry0/e pGPNRwfhi7GymDzjXA20UoqsB1WmD3xHRsuieYDQeZsT1o6yp8TlTTk9TPxxG6BNHH3wjf AgYKghYs/xzBs+1CE+JI+YCAvxRkeDe2udCgI1BctXUA+FU5obk24/T2fjbNHw+qKlIpLD 38bQ5kJv7pEIBbDHGPC4umEQTwoODGtfyyhXW/eG5Xfd7fi+SQ5USTv5wIUJXNTmt8LBlc JuflCzffx6uKYl7w6stGAli58K906V9IKECTY76jaepjWUdNsnEHirj25AFjVA== From: Ben Walsh To: Benson Leung , Tzung-Bi Shih , Guenter Roeck , "Dustin L. Howett" , Kieran Levin , =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , Mario Limonciello , chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org Cc: Ben Walsh Subject: [PATCH 3/6] platform/chrome: cros_ec_lpc: Pass driver_data in static variable Date: Wed, 15 May 2024 06:56:28 +0100 Message-ID: <20240515055631.5775-4-ben@jubnut.com> In-Reply-To: <20240515055631.5775-1-ben@jubnut.com> References: <20240515055631.5775-1-ben@jubnut.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4VfMtK468Qz9srm The module init passed extra data to the driver via the driver_data of a new platform device. But when an ACPI device already existed, no platform device was created, so this extra data wasn't passed to the driver. Stop using the driver_data and use a static variable instead. Signed-off-by: Ben Walsh --- drivers/platform/chrome/cros_ec_lpc.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/platform/chrome/cros_ec_lpc.c b/drivers/platform/chrome/cros_ec_lpc.c index e638c7d82e22..b27519fbdf58 100644 --- a/drivers/platform/chrome/cros_ec_lpc.c +++ b/drivers/platform/chrome/cros_ec_lpc.c @@ -76,6 +76,8 @@ struct lpc_driver_ops { static struct lpc_driver_ops cros_ec_lpc_ops = { }; +static const struct lpc_driver_data *cros_ec_lpc_driver_data; + /* * A generic instance of the read function of struct lpc_driver_ops, used for * the LPC EC. @@ -435,7 +437,6 @@ static int cros_ec_lpc_probe(struct platform_device *pdev) acpi_status status; struct cros_ec_device *ec_dev; struct cros_ec_lpc *ec_lpc; - struct lpc_driver_data *driver_data; u8 buf[2] = {}; int irq, ret; u32 quirks; @@ -446,15 +447,15 @@ static int cros_ec_lpc_probe(struct platform_device *pdev) ec_lpc->mmio_memory_base = EC_LPC_ADDR_MEMMAP; - driver_data = platform_get_drvdata(pdev); - if (driver_data) { - quirks = driver_data->quirks; + if (cros_ec_lpc_driver_data) { + quirks = cros_ec_lpc_driver_data->quirks; if (quirks) dev_info(dev, "loaded with quirks %8.08x\n", quirks); if (quirks & CROS_EC_LPC_QUIRK_REMAP_MEMORY) - ec_lpc->mmio_memory_base = driver_data->quirk_mmio_memory_base; + ec_lpc->mmio_memory_base + = cros_ec_lpc_driver_data->quirk_mmio_memory_base; } /* @@ -735,7 +736,10 @@ static int __init cros_ec_lpc_init(void) dmi_match = dmi_first_match(cros_ec_lpc_dmi_table); - if (!cros_ec_lpc_acpi_device_found && !dmi_match) { + if (dmi_match) { + /* Pass the DMI match's driver data down to the platform device */ + cros_ec_lpc_driver_data = dmi_match->driver_data; + } else if (!cros_ec_lpc_acpi_device_found) { pr_err(DRV_NAME ": unsupported system.\n"); return -ENODEV; } @@ -748,9 +752,6 @@ static int __init cros_ec_lpc_init(void) } if (!cros_ec_lpc_acpi_device_found) { - /* Pass the DMI match's driver data down to the platform device */ - platform_set_drvdata(&cros_ec_lpc_device, dmi_match->driver_data); - /* Register the device, and it'll get hooked up automatically */ ret = platform_device_register(&cros_ec_lpc_device); if (ret) { -- 2.45.0