Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3624362imw; Mon, 11 Jul 2022 12:18:00 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vFCO1ALChVp3oLwBEL+aqOIm7w8UHJ6VTQKcfH4+zfp6qztXH0jZuPY97CjWwK7Za0zmfG X-Received: by 2002:a05:6a00:1c94:b0:52a:b71d:5c65 with SMTP id y20-20020a056a001c9400b0052ab71d5c65mr16243090pfw.65.1657567080528; Mon, 11 Jul 2022 12:18:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657567080; cv=none; d=google.com; s=arc-20160816; b=fb3tbS+t9nPEsJ80F8pHtNJO1k0xgnH59OIxitkKv8lf5CjlfUROhQhOlvlFCc3vzO 3WrdzX83LUZV6BwGcwEjvx/WLXUAaxNmQycYMF1QV4ioacFlVJd85Eg2SHYVO40uwYND jZdT9NgnOdjriUM+NV03qMJKidZrMi6ylm5K6pqfw/0ggNaFNlqUNqZd9xTwAejmrsSH EfptPyKYtw75heN1411Rhz5YQaGis+FGcuWAssw6Xyo+AokJpnUNGzZETiQfSCPMpAS/ dwJMlugAS1+zLX4hKMkm0ADzEAPTnH/IenUEzT02XazMSCB1r7tirKrVDmOBrF59Svqo lWIg== 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=vdn+kWdlLc5kFjA8AyxY+9HV+a6I1ZLb2j4vBgodHP8=; b=O/cJy1xsNGuBshX8FALilNGqhvebf22w+oM2q/iGLAva04thUEacy5n0QuFdayQVyA UteaFJtvlTeRgdTLPz7uxbdiuV7+GxbNGuj+yp83wUEytp0ggJ7w6rCnzxMJBg+ZeLjv v51Xy1tg/98wxd+9c40VxFm//36zc3P8yaaR5FMX+HE+cepL49JJhCPA+xBzqSpsNv7l t634DYSw4SIjt9Jl6JwLtMJhillqTzXewOtWrFQ18vzCftpiqzvJgAXlylfKcFEoOxMs hvepAFFR3gEuhA2PfN1dxB3PzcJysgp1+lRQ1sez2a0a3fxTbxyf92d41YvxDyPQYjiE tEWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=nIgMnALM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e8-20020a170902744800b0016c09d28af1si9681819plt.621.2022.07.11.12.17.47; Mon, 11 Jul 2022 12:18:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=nIgMnALM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230477AbiGKSuN (ORCPT + 99 others); Mon, 11 Jul 2022 14:50:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229638AbiGKSuM (ORCPT ); Mon, 11 Jul 2022 14:50:12 -0400 Received: from mail-yb1-xb36.google.com (mail-yb1-xb36.google.com [IPv6:2607:f8b0:4864:20::b36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DA555925C; Mon, 11 Jul 2022 11:50:11 -0700 (PDT) Received: by mail-yb1-xb36.google.com with SMTP id 75so8925495ybf.4; Mon, 11 Jul 2022 11:50:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=vdn+kWdlLc5kFjA8AyxY+9HV+a6I1ZLb2j4vBgodHP8=; b=nIgMnALMjfiydsKZpOyh42VUXRWOAA/5gVzOGa7gtA+X4nWqSPxmdtDpom+kUzCWrF O4fDJRhl6UeOvWYXY2pEPjirrKOBA164uZkjagVFqy6+Jp++N+xzmpaJMElIgLMFtXPz w558uImDA/tKjtwXQt1MwAFFub4t/mwUktfkNfWfI/r1pxh8EZFubxzgR7un1XuEOLQK TXC4OwXeLAF7ewc8NuAhyCWHk6/CHLPK2oIMk7YTvI+zaWNyK38UVC5FOmAx5RTm4ymh glCAIkcMQZg2z6Lm/NCARAa4q6EPVS5C0d7qUivmD+eu+c1by9KjkWM/B77rnxFC6XyX QHDw== 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=vdn+kWdlLc5kFjA8AyxY+9HV+a6I1ZLb2j4vBgodHP8=; b=n6COzIheb3pK9/nYviTCjThvFkoL+zjAJVKR7GoACB8PuRadNyhe2OpMc9ssvqNIDL N86ofsfaHz3OAOzjUYSYNtEPGUQPn0vvG44TuOJ79H2QYBYMX1d/c416ip8Mhn5re1Rt i6zD3uCOirp1lRIVnPtCX5WboFF1o+GQWqXR29fUaxqkpHQ5Ux3e4YJlGBJUum6iinAz 2EJVM2B44kG2sG71OcEMLLRdxYKJCnnAjhcHnFqKSSFRxzOmCGMVaRQ5BqxbfDBiBA/d t0MJqwmfGFWTEtQexunWe43aLHAaa9uK/L1Z7Xws1y1pB/ZFLEyGMwzQ/LOIhlVwJczv 8A9w== X-Gm-Message-State: AJIora8lnqQNoBWb9n7/rc7T5MF9ovGI0M6xeE1vOT5Sb4GeITDW2HN/ KsqJ7QdyNQs3XCspCBQOf9aA1yq812WoZVFQX1Y= X-Received: by 2002:a25:dd83:0:b0:66c:8d8d:4f5f with SMTP id u125-20020a25dd83000000b0066c8d8d4f5fmr19018621ybg.79.1657565410549; Mon, 11 Jul 2022 11:50:10 -0700 (PDT) MIME-Version: 1.0 References: <20220711173418.91709-1-brgl@bgdev.pl> In-Reply-To: <20220711173418.91709-1-brgl@bgdev.pl> From: Andy Shevchenko Date: Mon, 11 Jul 2022 20:49:34 +0200 Message-ID: Subject: Re: [PATCH] gpio: sim: fix the chip_name configfs item To: Bartosz Golaszewski Cc: Linus Walleij , Andy Shevchenko , Kent Gibson , "open list:GPIO SUBSYSTEM" , Linux Kernel Mailing List , Stable Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Mon, Jul 11, 2022 at 7:35 PM Bartosz Golaszewski wrote: > > The chip_name configs attribute always displays the device name of the > first GPIO bank because the logic of the relevant function is simply > wrong. > > Fix it by correctly comparing the bank's swnode against the GPIO > device's children. > > Fixes: cb8c474e79be ("gpio: sim: new testing module") > Cc: stable@vger.kernel.org > Reported-by: Kent Gibson > Signed-off-by: Bartosz Golaszewski ... > struct gpio_sim_chip_name_ctx { > - struct gpio_sim_device *dev; > + struct fwnode_handle *swnode; I would call it fwnode even if we know the backend provider. > char *page; > }; ... > struct fwnode_handle *swnode; Do you still need this? See below. ... > swnode = dev_fwnode(dev); > > + if (swnode == ctx->swnode) > + return sprintf(ctx->page, "%s\n", dev_name(dev)); So, now it can be if (device_match_fwnode(dev, ctx->fwnode)) return sprintf(...); -- With Best Regards, Andy Shevchenko