Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp1744231ioo; Mon, 23 May 2022 02:09:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzF8XxTJcDUn8pul0sIB4RoEhMLUsYrpNsU5M6Eq8Qq57fNcgfMyspsdBXpbNQxTKq9aVMq X-Received: by 2002:a17:90b:17c6:b0:1e0:28bf:d429 with SMTP id me6-20020a17090b17c600b001e028bfd429mr10349547pjb.239.1653296968130; Mon, 23 May 2022 02:09:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653296968; cv=none; d=google.com; s=arc-20160816; b=e6vmWMrCm6AshQ6n1yhzLjqnAHBmk2g6af43MYzHxecvbVf7Ftn/gWxTAqETLIj2jl gA4OYBYFlqcM8qHK02lGYCH9FFOZaE+8iEp0Im6jqiHZiarv8oxPqCaVgVuLtn6AvtMg vXad4IyH03y0hME6ZPfbH162ZruaI2zjRgj+vL5+/ZqY+jeerhoK/e056P+PsygAIoiq Yag32btpuOxLkFciTO/Hiq4X36d+/NVzVT+kvAIaQL9di2fEvRGRc9cBkEfoAoQEDOEl Cpdw3CoZLzeJ1eOZr7EHa/8iEcljz7bqx5+bsvpFs0IyWth/SO8O04zq2Z+ubRh01UBW JZxA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=eC23RMBhaEz2+XAU6jRpJqAitsKJ2Y7xKoUbKiMq65U=; b=niK/Y0e7/Gar93RMxnJSN33JF7ENWg62qDMDWIP6oj6DL85Om3IfTJCX1Sroa/q77I +e/sa1haP2Y/N883rksXmhO+vDtbyMStmNYvpdsszMzguVKo49ujCRneW4V9wAv7s93i AIGq6u8JE3DmgZx+mpuljXYfmzUJ+hm28/u8IeLOMRyc5nHVqEXciBFRu6m8sfRvXa1w ArbNfidmw0/xEQDQ/aFZgXJsaJCx2pSj003DNttHF4Jvc7O6p977PM533erEYzhSlmhZ 69BkZXl73ZKt4Xby3orssglT5XCrUEEKvZ38BYW5kgWsSr/7DEsNmSMB1xKNZM1Xyhhb Kg5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SYg6xRay; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id u9-20020a056a00124900b0050dd86727b8si13362868pfi.349.2022.05.23.02.09.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 02:09:28 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SYg6xRay; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C9F1D45786; Mon, 23 May 2022 02:09:24 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232676AbiEWJJI (ORCPT + 99 others); Mon, 23 May 2022 05:09:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232695AbiEWJI7 (ORCPT ); Mon, 23 May 2022 05:08:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C15445062; Mon, 23 May 2022 02:08:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CBF8560F84; Mon, 23 May 2022 09:08:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99B52C385A9; Mon, 23 May 2022 09:08:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1653296937; bh=Q+d3XF3B7LVnN1nYfZWpSlRiPE0fKGy1w0hTJi3wqlg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SYg6xRayoZlRZAxXhNbLc52kS1I/F99HpDreqKFZ9LDgacRePlG8Is+xcnpqxAhMd 6Q61KsXgRPA96C6PCWapoXO8lW5Lo1YMla00HbbFnl2y655w5Xu5Ab2oqVQA8h9yHn CksedTBYu8EAIlmgJQVGet+9Da6V9Fq+wc+Tfo5S56pbM0jrIPDjNe1LAR+8Lk3xoS ADfyvZ7qdRZ968ArSRrMlw3xEIjIYrBwypnxaZ1xL9hkuQ3OtaTr4RcByeV3QUhhjn CLlzcKx4hDcoJ2vNlCULO8mi2G3HltJ8JEBcQ/WTjHlSfjC+r5vuxYkbqzuKa0d9fT 2ZIuXznbWC/qQ== From: Tzung-Bi Shih To: bleung@chromium.org, groeck@chromium.org, robh+dt@kernel.org Cc: chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, mka@chromium.org, devicetree@vger.kernel.org, tzungbi@kernel.org, Guenter Roeck Subject: [PATCH v4 4/5] platform/chrome: cros_kbd_led_backlight: support OF match Date: Mon, 23 May 2022 17:08:21 +0800 Message-Id: <20220523090822.3035189-5-tzungbi@kernel.org> X-Mailer: git-send-email 2.36.1.124.g0e6072fb45-goog In-Reply-To: <20220523090822.3035189-1-tzungbi@kernel.org> References: <20220523090822.3035189-1-tzungbi@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 For letting device tree based machines to use the driver, support OF match. Reviewed-by: Guenter Roeck Signed-off-by: Tzung-Bi Shih --- No changes from v3. Changes from v2: - Add commit message. - Add R-b tag. Changes from v1: (https://patchwork.kernel.org/project/chrome-platform/patch/20220214053646.3088298-5-tzungbi@google.com/) - Update email address accordingly. - Use device_get_match_data() per review comment in v1. drivers/platform/chrome/cros_kbd_led_backlight.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/platform/chrome/cros_kbd_led_backlight.c b/drivers/platform/chrome/cros_kbd_led_backlight.c index a86d664854ae..4bca880d7721 100644 --- a/drivers/platform/chrome/cros_kbd_led_backlight.c +++ b/drivers/platform/chrome/cros_kbd_led_backlight.c @@ -10,7 +10,9 @@ #include #include #include +#include #include +#include #include /** @@ -116,7 +118,7 @@ static int keyboard_led_probe(struct platform_device *pdev) const struct keyboard_led_drvdata *drvdata; int error; - drvdata = acpi_device_get_match_data(&pdev->dev); + drvdata = device_get_match_data(&pdev->dev); if (!drvdata) return -EINVAL; @@ -152,10 +154,21 @@ 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", + }, + {} +}; +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), }, .probe = keyboard_led_probe, }; -- 2.36.1.124.g0e6072fb45-goog