Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2234643pxp; Mon, 21 Mar 2022 14:33:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyaH5mFHOOKU3g5+VwW2/218pFKyfiYyG2qhutbbI2sVoNHTwJFh+hRtT0Yku9bq7bxi4o3 X-Received: by 2002:a17:90a:10c8:b0:1bc:e369:1f2c with SMTP id b8-20020a17090a10c800b001bce3691f2cmr1172490pje.193.1647898406163; Mon, 21 Mar 2022 14:33:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647898406; cv=none; d=google.com; s=arc-20160816; b=1IuU0neU8Jf4lKAE2UWurNiGhQ3j3VbaZZFwcZDZGkuCE6hgoeSAcTtUItgc2LwUwP 6Lh3pwgDXWZ8PgrxI1Ar8Aqw9hScTO9wAgNnVbjOfwZi28VmgK1Ugf9imGEp5xtbn1rP +gRbk5umVfNij3dLldJZSgDKkWWGhEH4Zsh3Vll1vfwbEMmDE7cnSO9P62ThiZOGtXUX vmwy2LYvRiSKJq+9c0L03VrZtd+ON1D1asnhcVOSXAvjNNPUdaBXgqPQ/4VKpHzZtsVg puU/Ii9OMy8aY3fDwyx4lRVjkJUKMuTHNEb/eyAx4B8Vv5w0/YS+3TNyySVTyOEuDkHy gxpQ== 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=vGZENVhYGPOcJ4GKb6eVmJgizKfn/TbUlB9mPN/EWqg=; b=RXv0PCim8NaTReMwkOLx4RQKHlOFY5uts6HhoT+71man92cPL2boQMM8u3lDzJ8QzP Ers/jcwrRu/Fs49qs2H8JuJ+c0EoR247kCFrNhXncf0ZnDGBME0E3eHUXt6VXNbWT8Am N6kbZl0r/OaUUIB7zsHhAaLQEUbEk3led/iFpwml6Finvv1E0v2BWlPlIKK2OiCV74Hx IjwdW8zxA2Xren0KbNQh/LwwuhTV+DqHkxr7PjWFEDKZ5OzcVJ+334W4yWql0qeeV25X eN0FBpTyodgdsldSA/N0Vjdo/cxwZzrrJBsBvoSPKqiiJndHBfFiVO0vj0K9TqbH+UVm BC4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GVj31NNC; 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 l18-20020a17090a599200b001c7532e6d3fsi361960pji.72.2022.03.21.14.33.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 14:33:26 -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=GVj31NNC; 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 7FA8523FF36; Mon, 21 Mar 2022 14:12:12 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344399AbiCUI63 (ORCPT + 99 others); Mon, 21 Mar 2022 04:58:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345514AbiCUI5x (ORCPT ); Mon, 21 Mar 2022 04:57:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E80626E780; Mon, 21 Mar 2022 01:56:28 -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 ams.source.kernel.org (Postfix) with ESMTPS id 885E3B81151; Mon, 21 Mar 2022 08:56:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D10B0C340F4; Mon, 21 Mar 2022 08:56:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1647852987; bh=JOxBbU85PIDh5q8fQ7u3tZbk+aC74evCjtf8jSmnQJ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GVj31NNC9haN0oT/wmRNbhOtPiJ0MDU/rdmyt/JATCvhKxY1s6cQ3O11/rYyv1yVi FArp0kGbpUUiM4f9yBCwJHMSFDJHtWHszg5j+nlDhfrPTMP3VROV78EOW0IsoHkmtA QYUDy0fIjj96CN6llz9TcOTlJwuDmmfLz5CmHXfBWnSy7ZGVS2F4is4dKJO+LLnDd+ TevaFSnZJQ5Ho4S5BR/QfAdSzmXbGIUQdQU0KPjhs2lnQ01vEs59vFuqICI78mnPGP ea+LVSV/njiHxnysuZOPpWuc/ygDGDzRIvT1Z7AnZ+U0GoGURe73xP7Z0PR1UXlL0l 1H7hNNFl5kfXw== From: Tzung-Bi Shih To: bleung@chromium.org, groeck@chromium.org, robh+dt@kernel.org Cc: chrome-platform@lists.linux.dev, tzungbi@kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Guenter Roeck Subject: [PATCH v3 4/5] platform/chrome: cros_kbd_led_backlight: support OF match Date: Mon, 21 Mar 2022 16:55:46 +0800 Message-Id: <20220321085547.1162312-5-tzungbi@kernel.org> X-Mailer: git-send-email 2.35.1.894.gb6a874cedc-goog In-Reply-To: <20220321085547.1162312-1-tzungbi@kernel.org> References: <20220321085547.1162312-1-tzungbi@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.5 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 --- 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 05b4f274086b..5cbe27cb4610 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 /** @@ -127,7 +129,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; @@ -163,10 +165,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.35.1.894.gb6a874cedc-goog