Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2640727lqp; Mon, 25 Mar 2024 05:25:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUMKCKbHUIj+XlGjMUaMxrT09Zw4EKWDI7fiQuCtjoIokynDK/PPjw9XHMpNPHjKZxknGxLS9arirGc9XV1+RjaDchPY2+Osj/+91nwUg== X-Google-Smtp-Source: AGHT+IEnO07VKol8t96kBff6q+7lWb9b7o+IEB/CZBOBuq+RlvOzoU30+vDSpkxxZdAmSEcI7evD X-Received: by 2002:a50:bae2:0:b0:568:9fc9:ec72 with SMTP id x89-20020a50bae2000000b005689fc9ec72mr4615440ede.35.1711369516190; Mon, 25 Mar 2024 05:25:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711369516; cv=pass; d=google.com; s=arc-20160816; b=EYjmpQoF4mqsDLqZgXlzRlQMOw0q7Fu2rhy1MqQsT9zaQPG41zm63VuJprw8mSv6zd reIYPlqckPRof/a+gz+6v8bn7oqpRW7KTuq0+njoEOdZXelq56qzoaRHmpJjFhEWU2p1 4gY80tWWW4zrVIIJ9MPc12tHxqWhfB75hSHRmO2BFHzogs2FaQrTT4yDusI1HkxpacB3 ksCqMcgDD9CXvl/clzoEwOnGC3NTw3gboXPCADto0Jyu3Wnc9/0NuSUFQYBa39DhO22o Qh+G9s/yLNcmNCieE6D3MBE/CYgNE8bK0GpOt0H6CzDOMwoeatSD5xjJ3RYMyKZF7g3P p35g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=3MoNcwBC9W9jI+iwxAp6oIzANetRIcEtWJLCCZtUyuQ=; fh=67EoFrBjq59lfxp5erOwLwAEi/+ff+RY1goOSTt/ZKM=; b=S1+6BK/hNG6UAvqhXEAYda463LcONA/McurBD/EHW8wo5FZ2fgMxgupPzDkZxTUAqx MFIqKVB3J0OmEuypiX3o2wh2DFKvAEHlg4gTwgQWCn6EOhFcCkDiyjFZtc9N5zsdp2VX ECQsCNRBm9mJ2vja1Eg+g93KVhT7P6Fy7eH28x1IPqegBNW86i+toiAdgkzGBrJq4hHA A3k4bR4S5taHjJWOiuMwI+yRJXw2Wme6ux/bsgOElIuLA3bjQp87xsw48cMQK6i72P4F F1jZHls274kPWT0a/ogsM2pf9q2iKRMgrRQaNP7UweFhX8aJQFcNbMQbCtGkFkeV/Jfj N6Tw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WMsc1e3w; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-116458-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-116458-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id s1-20020aa7cb01000000b0056a2eb7f144si2459290edt.419.2024.03.25.05.25.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 05:25:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-116458-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WMsc1e3w; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-116458-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-116458-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 am.mirrors.kernel.org (Postfix) with ESMTPS id E6C9C1F38604 for ; Mon, 25 Mar 2024 12:25:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D6E7615A4A2; Mon, 25 Mar 2024 07:31:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WMsc1e3w" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A50DB178891; Mon, 25 Mar 2024 03:24:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711337099; cv=none; b=rFia1D1Ii2+pYkOZkLCn3hlPc99ll0riCFBBJ/uAiJJhY2SQ/O3W7oS3tnQmH36SKDm6ilj3m9L24oMHsfjK6DD9B6L4fciwP344W0tUMJ/nZ+S7BLCm3GcmozrvYxJVznebx4MFX1tHVZF00dtLUkQhAcIytvhxueTjIQy2nPw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711337099; c=relaxed/simple; bh=GakVguLw7Lf5f5Bnjeick8QQQVW5ZbSnjq4ik2Jrhtg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=cLnvYO6w0Cu9UtuspORNz4l8Fo98Jmhz/WsF2c7WukkF2SOfpnSSQjQuOr+kKLwA8sjr/H4qFnv/ZIluxaVPQ7bh4yruSNFgjCbyr+gy4pqPblVfIyNwJogQR/dR3hPAxRzsd82zFjVP8cwH/+U0TDF4Y30SWNECLQD3+QQfjOI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WMsc1e3w; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 246EBC433F1; Mon, 25 Mar 2024 03:24:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711337099; bh=GakVguLw7Lf5f5Bnjeick8QQQVW5ZbSnjq4ik2Jrhtg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WMsc1e3wpuTRL3x0WYjsA3UoiisjhwQyJtQPJoqpSZnM+1GvokBtbQ20vuSLEGHlp wh5NZaQE75OEYKu+O0gro1bHzs/CRzer2IWoS9NIV2eVZyGUJHJU3fDX5KUjGVv8xL CgYBD+QQ01bsCyZSXzcETKuv8Sm4fw9wPG9TLp8V0JgA7yAnzILTk6llYbZmdRImsF ZvdOmHxCFy4gUOju0YyYsBc1qMl6f5tmUbIxswIpkfeAumFNZiXg9fVt26FvFvjfQp dvUR2SmtCrcmkt2O+Mxdp8/YoRFwA82eKqUx56+1ku+hnVojIyCKTo2v/AicAUGJu9 GZj7Vx7MdZfCg== Date: Mon, 25 Mar 2024 11:24:56 +0800 From: Tzung-Bi Shih To: Stephen Horvath Cc: Lee Jones , Benson Leung , Guenter Roeck , chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] platform/chrome: cros_kbd_led_backlight: Automatically enable keyboard backlight control if feature present in EC Message-ID: References: <20240322102800.1322022-1-s.horvath@outlook.com.au> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Fri, Mar 22, 2024 at 08:27:58PM +1000, Stephen Horvath wrote: > I also fixed a bug that seemed like there was some confusion between > `cros_ec_dev` and `cros_ec_device`, so I'm not sure if this module even > worked until now. If they aren't part of commit message, please put them after "---". Please separate to an independent patch if they fix different things. > diff --git a/drivers/platform/chrome/cros_kbd_led_backlight.c b/drivers/platform/chrome/cros_kbd_led_backlight.c > index 793fd3f1015d..06e9a57536af 100644 > --- a/drivers/platform/chrome/cros_kbd_led_backlight.c > +++ b/drivers/platform/chrome/cros_kbd_led_backlight.c > @@ -171,12 +171,15 @@ static int keyboard_led_init_ec_pwm(struct platform_device *pdev) > { > struct keyboard_led *keyboard_led = platform_get_drvdata(pdev); > > - keyboard_led->ec = dev_get_drvdata(pdev->dev.parent); > - if (!keyboard_led->ec) { > + struct cros_ec_dev *parent_ec = dev_get_drvdata(pdev->dev.parent); I'm not sure if it really fixes anything. See [1] or [2]. [1]: https://elixir.bootlin.com/linux/v6.8/source/drivers/platform/chrome/cros_ec_lpc.c#L417 [2]: https://elixir.bootlin.com/linux/v6.8/source/drivers/platform/chrome/cros_ec_spi.c#L759 > @@ -200,8 +203,10 @@ static int keyboard_led_probe(struct platform_device *pdev) > int error; > > drvdata = device_get_match_data(&pdev->dev); > - if (!drvdata) > - return -EINVAL; > + if (!drvdata) { > + /* Assume EC if no match data is provided */ > + drvdata = &keyboard_led_drvdata_ec_pwm; > + } By current design, the `drvdata` should be provided by either ACPI or OF match. > @@ -236,22 +241,10 @@ static const struct acpi_device_id keyboard_led_acpi_match[] = { > MODULE_DEVICE_TABLE(acpi, keyboard_led_acpi_match); > #endif > > -#ifdef CONFIG_OF > -static const struct of_device_id keyboard_led_of_match[] = { > - { > - .compatible = "google,cros-kbd-led-backlight", > - .data = &keyboard_led_drvdata_ec_pwm, > - }, > - {} > -}; > -MODULE_DEVICE_TABLE(of, keyboard_led_of_match); > -#endif > - > static struct platform_driver keyboard_led_driver = { > .driver = { > .name = "chromeos-keyboard-leds", > .acpi_match_table = ACPI_PTR(keyboard_led_acpi_match), > - .of_match_table = of_match_ptr(keyboard_led_of_match), The patch is ruining the use cases in OF world (e.g. [3]). [3]: https://elixir.bootlin.com/linux/v6.8/source/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi#L1154