Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp466903rdb; Fri, 6 Oct 2023 08:36:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEbogP9gATlmoaprXJxOdTB/f3TTE5VDtgTOh+E46FlExhTG1yghDE9FPhoCSmDwUWOQ+Rh X-Received: by 2002:a05:6a20:2446:b0:14c:e8d4:fb3e with SMTP id t6-20020a056a20244600b0014ce8d4fb3emr9599454pzc.43.1696606588083; Fri, 06 Oct 2023 08:36:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696606588; cv=none; d=google.com; s=arc-20160816; b=Kvf9KUxGtG1tFtzGTTMf6DIbSRe35+OaVjtxrTRzOnjexmsR/dIJIyV57YyWexMl9l Ak7RaK1XMELWsGVDtUi6GnUXJfkblzCoydgaWdgZlJgMH/VTHo6W3Ir9XbOCgvJV7Nak HWapSQ+YFmeRLyTxpuTlBN01vM05UcKwSvTldvV2QZz8/0swPYl4WdtRSoLYtaHo/A/m NcTS7seTI8fQj3r73gHfURMceF0j7tP2vacH3nIUSqWNLQdGcLGK/9AZ/l6escVuLwH1 Yyln6V/dTxsECwowH4aDtmfOxOTpv/gnlcUl/4KFoS1mAsuPXsRYg4IQDDNuoyDSBvlm kEYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=nm81sd5g6L/uk9Dy8jwBzSBl6p2VXrLcmdyYwUU4Xvg=; fh=Btjz0HjpVDHR9kNh1mUqTh3O35fMOBaSaeHrkvL7rTs=; b=OLqWamqXfgs/HJGpC8NN6cV1TrIfgLl8QwRA+UW73yWzM5eJz1Sq1Mp2n333svv/Uk xYDQb0q9YoFEXm9y1t82Jecz4J+uUnrQkZNIzZFWipWUnSooQFCVuolRJgPqHECVGPrG hVc8Fb3yV/uQ54DiY+wPux/CrE7QVZubCeajFrZ3/29x3x2GhZ89nFnnNXk82nvwi1RL ykDq/uKd6WsArV/ZUY5PMrS7zMzCCPAxJS1NKLLnNxmNNU/H/hTU9ivIn6bg5SDLua2V P98LUxHu5at0gDt3K9f64fHsIsd1F0lS1xaJlNcHgodDPqhySJ60ghuFso4iuzu9c8Ci TLKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RBOoqYOF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id r37-20020a635165000000b0055e607f1e99si3839804pgl.882.2023.10.06.08.36.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 08:36:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RBOoqYOF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 26C8A8024FBE; Fri, 6 Oct 2023 08:35:46 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232854AbjJFPfM (ORCPT + 99 others); Fri, 6 Oct 2023 11:35:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232851AbjJFPfL (ORCPT ); Fri, 6 Oct 2023 11:35:11 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53DA9AD for ; Fri, 6 Oct 2023 08:34:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696606463; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nm81sd5g6L/uk9Dy8jwBzSBl6p2VXrLcmdyYwUU4Xvg=; b=RBOoqYOFTkaNI6Qz0+xJ0UafPi1ha7Edi/QTrZAOWjBPoRyKKEyI/etTni9X3EDCJ8aiPq +joRxtlfRdMhC6Zm/JMO718g7hOFt7TX4bKKRZF0FY5yeW4SIE5p/d/Gr65HETr0rGjQzO 2T2x6aE0S9piSSrpV4KbxkGJOwnc/90= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-544-Hr55XoDvNqyiS4Ke_C-x3g-1; Fri, 06 Oct 2023 11:34:22 -0400 X-MC-Unique: Hr55XoDvNqyiS4Ke_C-x3g-1 Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-9b822f5c156so194807466b.3 for ; Fri, 06 Oct 2023 08:34:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696606461; x=1697211261; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=nm81sd5g6L/uk9Dy8jwBzSBl6p2VXrLcmdyYwUU4Xvg=; b=L0z9LL/N45cNaAT2ORb27YP0FX/2sszXQW8q6homWePCaOd4YCXI7G5NsP5BfqkF6A lMcwNTvnuAiNe3khYvl8e+r+kUoksZc4yzMB3bLfOX338cNbJN72oDFMMi75UbvDJoFR ODQoH+HWtJyiicYgGGJWNKZU4X9TBBvKJaNp5MU9Lbetb2zqd9HarPe3T/lBiwQ6HjhH sQ2hkchgl7xo4X7gZUxTZ5mLH4nGPDGqwGvg99rzEhdzfxV0hCH/OqO7FcQqs9oaND+m wKPgMYsIEvmGzhHCreB8/6EwGMBT/NHc2qKDXgTT1ANRR0C8tbLlu+jbqmEDnrC1+ClY OsLQ== X-Gm-Message-State: AOJu0Yyra/mieal3gMVEg51kRhtndLtAhmurLehcJ/En4G8Dl4b8fkli 956Of/TMhBUS16V9dKe0KK6s8rXut++6Vv2HHlxomexCbo7h7Vhw3EEOLOjYgfcTaiyg8ixRxxJ 8OGC3yBXZvQnAHKPcVhr1AT00 X-Received: by 2002:a17:906:3ca9:b0:9ba:7f5:3602 with SMTP id b9-20020a1709063ca900b009ba07f53602mr178348ejh.60.1696606460861; Fri, 06 Oct 2023 08:34:20 -0700 (PDT) X-Received: by 2002:a17:906:3ca9:b0:9ba:7f5:3602 with SMTP id b9-20020a1709063ca900b009ba07f53602mr178335ejh.60.1696606460553; Fri, 06 Oct 2023 08:34:20 -0700 (PDT) Received: from ?IPV6:2001:1c00:c32:7800:5bfa:a036:83f0:f9ec? (2001-1c00-0c32-7800-5bfa-a036-83f0-f9ec.cable.dynamic.v6.ziggo.nl. [2001:1c00:c32:7800:5bfa:a036:83f0:f9ec]) by smtp.gmail.com with ESMTPSA id p26-20020a1709060dda00b0098921e1b064sm3029251eji.181.2023.10.06.08.34.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 Oct 2023 08:34:20 -0700 (PDT) Message-ID: Date: Fri, 6 Oct 2023 17:34:19 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v2 1/1] platform/x86: xo15-ebook: Replace open coded acpi_match_device() Content-Language: en-US, nl To: Andy Shevchenko , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?UTF-8?Q?Ilpo_J=c3=a4rvinen?= , Mark Gross References: <20231006153152.3502912-1-andriy.shevchenko@linux.intel.com> From: Hans de Goede In-Reply-To: <20231006153152.3502912-1-andriy.shevchenko@linux.intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Fri, 06 Oct 2023 08:35:46 -0700 (PDT) Hi, On 10/6/23 17:31, Andy Shevchenko wrote: > Replace open coded acpi_match_device() in ebook_switch_add(). > > Note, while it is a bit longer it is more robust in case > more IDs will be added. > > Signed-off-by: Andy Shevchenko Thanks, patch looks good to me: Reviewed-by: Hans de Goede Regards, Hans p.s. This driver too really should be converted to not be an acpi_driver instead it should bind to the instantiated platform_device for the adev, but that would require someone with actual hw access to test the conversion ... > --- > v2: fixed compilation error > drivers/platform/x86/xo15-ebook.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/drivers/platform/x86/xo15-ebook.c b/drivers/platform/x86/xo15-ebook.c > index 391f7ea4431e..2ae8a58adcd0 100644 > --- a/drivers/platform/x86/xo15-ebook.c > +++ b/drivers/platform/x86/xo15-ebook.c > @@ -81,9 +81,9 @@ static SIMPLE_DEV_PM_OPS(ebook_switch_pm, NULL, ebook_switch_resume); > > static int ebook_switch_add(struct acpi_device *device) > { > + const struct acpi_device_id *id; > struct ebook_switch *button; > struct input_dev *input; > - const char *hid = acpi_device_hid(device); > char *name, *class; > int error; > > @@ -102,8 +102,9 @@ static int ebook_switch_add(struct acpi_device *device) > name = acpi_device_name(device); > class = acpi_device_class(device); > > - if (strcmp(hid, XO15_EBOOK_HID)) { > - pr_err("Unsupported hid [%s]\n", hid); > + id = acpi_match_device(ebook_device_ids, device); > + if (!id) { > + dev_err(&device->dev, "Unsupported hid\n"); > error = -ENODEV; > goto err_free_input; > } > @@ -111,7 +112,7 @@ static int ebook_switch_add(struct acpi_device *device) > strcpy(name, XO15_EBOOK_DEVICE_NAME); > sprintf(class, "%s/%s", XO15_EBOOK_CLASS, XO15_EBOOK_SUBCLASS); > > - snprintf(button->phys, sizeof(button->phys), "%s/button/input0", hid); > + snprintf(button->phys, sizeof(button->phys), "%s/button/input0", id->id); > > input->name = name; > input->phys = button->phys;