Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp593330pxb; Tue, 15 Feb 2022 23:09:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJxfFO6wuc6KTJcMkIvVdCKSBg2sD2zuu/6UYzLtZVKTc+W6/KMOtceoBwp/IGrJK0z9oOdg X-Received: by 2002:a05:6a00:be5:b0:4e1:9050:1e16 with SMTP id x37-20020a056a000be500b004e190501e16mr1607752pfu.78.1644995381498; Tue, 15 Feb 2022 23:09:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644995381; cv=none; d=google.com; s=arc-20160816; b=bpXSxPPrCA7wGmZtePqjY3pLjBBNQQtHHJUc5UmRuphaE3QoCQk4Ql4gzOX7jbpV6b p/7Ql8UyqK7JpSFzP3z+ZVLtFFIKuB82VfdtdTrVAiIx2AlsZwtq1vkigYwGX+w8xfWn tE9A6yZWkU2r3T9XGhJ7SG4aZaCNwY1bGoFJuaKgo1XuCRwwVN+VGMVckKoH3Ww/EuqT mtJ5QmBIIm54q59LB5KnTR4ZctgAlf3YKVniluQ8FxCdnbfTvnMvsqJiUXssgOyDYCgs OMiedY+aAtxxn3iVnxnI4ujnThiQqB18257HJDLbClcTntQJIHLCs6YOhbTpcUwX4Zci J9BQ== 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=kEAvnISlAgpQaUg6TOaHvEbXUrTyCqH15xyEbDSJWp0=; b=n6wOkXJ2MBbztn0dt3z/xdveym94IrA9EVeSH4m7PYbuzQZ/GN8UaGEjq40O0M5FP0 b3/wFX5P1JWBj2vXEVNv3HEIH4S8aKYnT1ZWHUSqCSrbzXiz5YI/sRjkoK+9wTC8Prlx 6uLrBg5HJMzsQMsjBn27P4rtx0FQHwY9+djZqcWf3plj4yWepKkL0wHKPVNdFsRSD7fX qHHwHG41/A6ggcDdKvXcKfMi2waWZ5i0N3WxIFQ8VAm51xyQwqg3Bt6yWAvzvDVZ/1SL BLdgcPa0HRNH4TpDLORdWEryadcR5Y5DFKVlmkPwxN5NWVg1PtVNNG8LhyLIWFQmymXm 2UiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ZUZR+o7N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id i3si17174933pla.225.2022.02.15.23.09.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Feb 2022 23:09:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ZUZR+o7N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A12A622BDDB; Tue, 15 Feb 2022 22:46:14 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244888AbiBPBLE (ORCPT + 99 others); Tue, 15 Feb 2022 20:11:04 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:35978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245488AbiBPBK4 (ORCPT ); Tue, 15 Feb 2022 20:10:56 -0500 Received: from mail-yb1-xb29.google.com (mail-yb1-xb29.google.com [IPv6:2607:f8b0:4864:20::b29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D0EEFA203 for ; Tue, 15 Feb 2022 17:10:16 -0800 (PST) Received: by mail-yb1-xb29.google.com with SMTP id c6so1411228ybk.3 for ; Tue, 15 Feb 2022 17:10:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=kEAvnISlAgpQaUg6TOaHvEbXUrTyCqH15xyEbDSJWp0=; b=ZUZR+o7NNuMwO1tDYO+QNJg+NoAX33xWhrua8Z8KDMfC2GLtSZdyUBrn9hqmZc011V H9AOPKO1ShSUjtslz814QmDGdWyq4XsFxbPx9NTsbv9s9VZzqH4Rb7d+mDBITNARApIB ztT+jp2GyBVb3rGGQap/Dk+L7wisatjFXx0T8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=kEAvnISlAgpQaUg6TOaHvEbXUrTyCqH15xyEbDSJWp0=; b=2iRWlLTsci7+WWENUG/tBXl4rU5fgYqlNRVZQq9wET+Gq4XECv/J3RlDX1kcDsZavz faN8AnclH6gCQkmmseO6G26VqFHeRdfjT9I5n+vDJzKaLksi7dXrLfGMejKBa4yTvDHS Y8Z6g7ghjqEpuHk7h2NKZFdT+xRph5HaUvqd6ZXKctej5zf2py/hIGPk13wk5iV1ww1B ndWQCZMlmBVzF7PUodLrywmrd+zaB5JXhaHUWkNdJEA9Ea8e1GXk9gWRsgN11DMtVfy2 abqMdoZPGzgZF3vNRuLNFip3raGNKfARMeiEaYM6cUytXnygBrfBFvWaPHPPOQvSTEIZ lO2g== X-Gm-Message-State: AOAM5331NJkM/T+huQdFu+z+2Mev8JfD/+09vwPfIBHGxFvscUfuJ3I8 dGqpsPd7Mj+REbm5k+RwKNSVL2hJBdPvlGr9j0qIrA== X-Received: by 2002:a05:6902:108:b0:621:165e:5c1e with SMTP id o8-20020a056902010800b00621165e5c1emr307818ybh.204.1644973815876; Tue, 15 Feb 2022 17:10:15 -0800 (PST) MIME-Version: 1.0 References: <20220214053646.3088298-1-tzungbi@google.com> <20220214053646.3088298-5-tzungbi@google.com> In-Reply-To: <20220214053646.3088298-5-tzungbi@google.com> From: Prashant Malani Date: Tue, 15 Feb 2022 17:10:04 -0800 Message-ID: Subject: Re: [PATCH 4/5] platform/chrome: cros_kbd_led_backlight: support OF match To: Tzung-Bi Shih Cc: bleung@chromium.org, groeck@chromium.org, robh+dt@kernel.org, chrome-platform@lists.linux.dev, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Sun, Feb 13, 2022 at 9:37 PM Tzung-Bi Shih wrote: > > Signed-off-by: Tzung-Bi Shih > --- > .../platform/chrome/cros_kbd_led_backlight.c | 17 +++++++++++++++-- > 1 file changed, 15 insertions(+), 2 deletions(-) > > diff --git a/drivers/platform/chrome/cros_kbd_led_backlight.c b/drivers/platform/chrome/cros_kbd_led_backlight.c > index 814f2b74c602..ba853e55d29a 100644 > --- a/drivers/platform/chrome/cros_kbd_led_backlight.c > +++ b/drivers/platform/chrome/cros_kbd_led_backlight.c > @@ -10,6 +10,7 @@ > #include > #include > #include > +#include > #include > #include > > @@ -128,8 +129,11 @@ static int keyboard_led_probe(struct platform_device *pdev) > int error; > > drvdata = acpi_device_get_match_data(&pdev->dev); > - if (!drvdata) > - return -EINVAL; > + if (!drvdata) { > + drvdata = of_device_get_match_data(&pdev->dev); > + if (!drvdata) > + return -EINVAL; > + } I'm not familiar with this driver, so can't do a full review, but shouldn't device_get_match_data() from property.h [1] be able to handle both DT and ACPI cases? [1]: https://elixir.bootlin.com/linux/v5.17-rc4/source/include/linux/property.h > > if (drvdata->init) { > error = drvdata->init(pdev); > @@ -161,10 +165,19 @@ static const struct acpi_device_id keyboard_led_acpi_match[] = { > }; > MODULE_DEVICE_TABLE(acpi, keyboard_led_acpi_match); > > +static const struct of_device_id keyboard_led_of_match[] = { > + { > + .compatible = "google,cros-kbd-led-backlight", > + }, > + {} > +}; > +MODULE_DEVICE_TABLE(of, keyboard_led_of_match); > + > 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), > }, > .probe = keyboard_led_probe, > }; > -- > 2.35.1.265.g69c8d7142f-goog > >