Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp876755rdg; Wed, 11 Oct 2023 07:59:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEVSLo3wgXfP/cOqWMVpMJlxQDccBkB1JbGUSpxSqXS9w01lt6EI8LkJpfHdQih6VHuNz05 X-Received: by 2002:a05:6a21:788b:b0:171:4921:f1b7 with SMTP id bf11-20020a056a21788b00b001714921f1b7mr6893347pzc.41.1697036372876; Wed, 11 Oct 2023 07:59:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697036372; cv=pass; d=google.com; s=arc-20160816; b=symHKXFQr637+JR0vj6v0b5FMyjZoX6wLG+PW+TI5pp0T9jWiaO9a7jM1C1oRuMov6 +YZBfEoixmADiHFVy3LvWgQ2R+CGzPkkMbzXS+/OSaOvp16D/sqw34t+/ro+XXYiSSfS NsBl0YSjBe4w9oE9GZQ2+YrAz69YJIM1UotuMfrW/x2Qdd40nxNSCTDiZKrvISR9pl/F 6gVroqGZtE5MGttf5uBFPE+jv1llvrbIKUPjig8V80nDv6tFEXTLcnX2Jl6xxN+uyaoF VnTTTA2H4ALasgEi1joasw/Ba0dng45LgUrVUf+SEXbFty+mSLvxma2/iPFzc07HN5JG YapQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=cuAto40Y7hByUQAc+nvsdMF9StIgNHCCZkEW8vc0jnY=; fh=w/gHG0Mlf4bZClJcNj8pCFYskpNciadYy6hGoEZdQBE=; b=Td9nYT8vUiEd4M4D+DyybTwIaqK67KQ5wtTXQ3o0cSxiVMJWZkcfxt26zRDdv54DEb dECILdMc/v0rhC9MqFPMAv28gpSLvebNBW36NBI47jUzmVGQlaJ5TtN+hj6fiali+86Y tCvhXSPLqDYAbSD1cKPS+puwwJUNdAyXF/XECb7QFh67s3Keuc1agSzqz85kBY9AAxaJ BDOUL71Jp/1Brlg5P4lLzSi23OgObCx/Z7VVDdHXYSYXVmV9cEUZM2hqCsvz8sQAn8m/ JBiSb8LoIaeyQDzK5dmHAAdbABJTKE60VBLFzyG4HkvLxjXBeY0Bf68DBjoWi6C3RL9Y bHiQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@axentia.se header.s=selector2 header.b=Lk3lfPsf; arc=pass (i=1 spf=pass spfdomain=axentia.se dkim=pass dkdomain=axentia.se dmarc=pass fromdomain=axentia.se); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id z16-20020a656650000000b0057c2f61474asi14030757pgv.290.2023.10.11.07.59.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 07:59:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@axentia.se header.s=selector2 header.b=Lk3lfPsf; arc=pass (i=1 spf=pass spfdomain=axentia.se dkim=pass dkdomain=axentia.se dmarc=pass fromdomain=axentia.se); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 1CADD8177332; Wed, 11 Oct 2023 07:59:30 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232650AbjJKO7Q (ORCPT + 99 others); Wed, 11 Oct 2023 10:59:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231129AbjJKO7P (ORCPT ); Wed, 11 Oct 2023 10:59:15 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2129.outbound.protection.outlook.com [40.107.22.129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1690A92; Wed, 11 Oct 2023 07:59:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UuWo8l1jkoZuJ07tbDGRZHgRjzQqBdJxQwdvTsB6bsIEXWV7bm2TsougqC/VfN4OjKyL7unRYpb0ITIJLaseUsVVMLAJrUwfYJm7schD+o6H35m9MSFse45gltNKkXBQED/8gAoyvBPH9X0oKhM/IoV/F7NwEZ0vt58AqySFrwNUJLG6wNqtnrWPCj7OIQmYh1CrxcpsIu4ynD9bU5LlgOT1r8/FtHl1Ac0N/G6bONr4uLcOEgxeQZKzbUlgMAvW0Z2c/7aqNP6k8ZuLD9lE10Ym/XMwHX5svRhOkAk5CS3NfFhgy+OweFkTEgvsE+OLVy7mvdYWj8C0FIlKCF+kUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=cuAto40Y7hByUQAc+nvsdMF9StIgNHCCZkEW8vc0jnY=; b=S6Z5LYXV6kJ0XL//46kGs2CCKiDubx/upoaqX/W8yn0XJJwAse+s5d30c1Cc1xmLRlnAJZgwSD5ogw0ZcBGSxsLMQZ69yQQTzfXusx51zUloBFmSOTeJ+o5eQkAkyneiSzNJ3d53SYJBPqkz3Bf57OkSYdcpkH48ehjsBBW8f3XSHXsSuWdq5F3s+BE8ZsQZDOQ5pTCfz4jkQ0EdrDtLdy5Mr5+VEM2VoniykpJjrihD2mGLR5PS9eACtEZtPDqac0xNwx+IEDRBbSTvmLzx5reUzJR5v22icYn6R7adh96tnrTnlm5/nENV/PqjkiECSPPiEmYmz6wDt0aEy662eQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=axentia.se; dmarc=pass action=none header.from=axentia.se; dkim=pass header.d=axentia.se; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axentia.se; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cuAto40Y7hByUQAc+nvsdMF9StIgNHCCZkEW8vc0jnY=; b=Lk3lfPsfgJvnbvki9my3etMgFsz2XqmURN5pFA3EZqtK6/0mjEzs6reqj/7oEsDUXfBAb9/qbDyt+DEINTzbiHcSGIMdEZjM8eXt5yGixBULEe7VOO0lckZ7BYd3RTJyfcQHXwrHadQYQXWLm+NEuqWdtJlaUL5O2Wtp86dsUxg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=axentia.se; Received: from AM0PR02MB4436.eurprd02.prod.outlook.com (2603:10a6:208:ed::15) by AS2PR02MB8913.eurprd02.prod.outlook.com (2603:10a6:20b:544::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.37; Wed, 11 Oct 2023 14:59:10 +0000 Received: from AM0PR02MB4436.eurprd02.prod.outlook.com ([fe80::4ba4:83a5:e60c:3a5d]) by AM0PR02MB4436.eurprd02.prod.outlook.com ([fe80::4ba4:83a5:e60c:3a5d%7]) with mapi id 15.20.6863.032; Wed, 11 Oct 2023 14:59:10 +0000 Message-ID: Date: Wed, 11 Oct 2023 16:59:08 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH 3/3] i2c: mux: gpio: don't fiddle with GPIOLIB internals Content-Language: sv-SE, en-US To: Bartosz Golaszewski , Linus Walleij , Andy Shevchenko , Peter Korsgaard Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, Bartosz Golaszewski References: <20231011130204.52265-1-brgl@bgdev.pl> <20231011130204.52265-4-brgl@bgdev.pl> From: Peter Rosin In-Reply-To: <20231011130204.52265-4-brgl@bgdev.pl> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: MM0P280CA0097.SWEP280.PROD.OUTLOOK.COM (2603:10a6:190:9::6) To AM0PR02MB4436.eurprd02.prod.outlook.com (2603:10a6:208:ed::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR02MB4436:EE_|AS2PR02MB8913:EE_ X-MS-Office365-Filtering-Correlation-Id: b31ba7f9-7ff8-4218-9724-08dbca6aa004 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: J1e+OmwyaChvQU7rVmnxAQbQ7iReaaEM5MK5RQc4XMyWAifaNfYbimD31tPtckckO/BFWDhVaxitP58R16Qcar5TMjDW5arKBp2f8fHMA+pFE4bbpmq1U3/8aBiuqj6+eoXl5I+0xpb/glqzURZi6tKKzXGQ69+5Fq1VEp1vCfM0xkTD++olpccIcOkZlC3jgtt5bWhAC/TydxZ+n7UuGfMsa+9G7VSqhTwS3YD04f1TGDUf1V7vU+7M/mdMtFJ4oDkIWJCIAQ1+iwI+mhB4k/mr25FKkQGKSoqSUaAdNMwn5JqYquFmM43VesppMfFBvpy8hzzCs4uV2wXmtk+M5xER6nXfGU75j1jnrXIFtNdu8QXSB4MC79PvmXEyiiMsmLzc00bLH8xzGCsMDa29HB2YFHBk8yd4IwNfl8zW9+k/WxPADAI4pDk7EfSPzPDMto55h3GQ2KZGFOKDTYW4EUde3DXWE8ByYPo08+9H5MSSSNs2RSozdf7ETW0suaxeK52+jdX454D+GSvxNhsX2V38YBQOCyVhXo7IkIW1xvFpRv2TJFUKHwHOajaIQYg1umyz7ZiF79MR3cjSJ9ujgzl1vdTj1ZE/m5tUGzcdIVP40v70jW0adC3JSAQwnSktzwX+sITjugxk0P8tBnfPpw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR02MB4436.eurprd02.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(39840400004)(366004)(376002)(346002)(396003)(230922051799003)(64100799003)(186009)(1800799009)(451199024)(2906002)(83380400001)(316002)(26005)(2616005)(66556008)(66476007)(110136005)(5660300002)(4326008)(41300700001)(478600001)(6512007)(4001150100001)(6486002)(8936002)(8676002)(6506007)(36756003)(38100700002)(86362001)(31696002)(66946007)(31686004)(45980500001)(43740500002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?YzRXUmZIUEU0VW1tRGg5UkVIWUpsVjFPZjhtaFB4OGM2K3NuTTFjNjNpOG1y?= =?utf-8?B?b3g5dU9icjh1ZDRTUC9tSzl4QUdzcVZEdEhTV2hxeXJ3bVVZM2pXblZOazYw?= =?utf-8?B?OEY2bE0xYlVOUU5qaUhMc1BUQk14Y3hFeWpOQVJlNnNQemUxQjlaNVVnSG1S?= =?utf-8?B?R1pZTm5NMytVM2U3ZVA2OTFKVHhQU0NIdDEzMksyM3VKT2NYNm5XZ25HZ2do?= =?utf-8?B?R2k1QzhBYzcxRUFBWGEzUVE4MXlNeFBtNGhxRm1tVXhScjBXdFVLNmUrdXBK?= =?utf-8?B?bVROODE2cHNRVjQwRGl3TEZJa0UyQTBodjR0Ti90NHB3bHUydE1HYmtYeFZX?= =?utf-8?B?eE1iSVVKbHg1dVVKUWYrLzJUU2QrV0dDSHZOMStPYjNrWHE4WFNmV0JkWTFz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ant-AuthSource: AM0PR02MB4436.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2023 14:59:10.4094 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4ee68585-03e1-4785-942a-df9c1871a234 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: GFKNu2sjZ7zta0p9LmuS/2hXzqc84YBGhVYDowwsM1dLYJPYAM6ZrLDhuMJw0w8J X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR02MB8913 X-Spam-Status: No, score=-0.6 required=5.0 tests=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,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.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 (pete.vger.email [0.0.0.0]); Wed, 11 Oct 2023 07:59:30 -0700 (PDT) Hi! 2023-10-11 at 15:02, Bartosz Golaszewski wrote: > From: Bartosz Golaszewski > > Use the relevant API functions to retrieve the address of the > underlying struct device instead of accessing GPIOLIB private structures > manually. > > Signed-off-by: Bartosz Golaszewski > --- > drivers/i2c/muxes/i2c-mux-gpio.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/i2c/muxes/i2c-mux-gpio.c b/drivers/i2c/muxes/i2c-mux-gpio.c > index 5d5cbe0130cd..48a872a8196b 100644 > --- a/drivers/i2c/muxes/i2c-mux-gpio.c > +++ b/drivers/i2c/muxes/i2c-mux-gpio.c > @@ -14,8 +14,7 @@ > #include > #include > #include > -/* FIXME: stop poking around inside gpiolib */ > -#include "../../gpio/gpiolib.h" > +#include > > struct gpiomux { > struct i2c_mux_gpio_platform_data data; > @@ -176,7 +175,8 @@ static int i2c_mux_gpio_probe(struct platform_device *pdev) > } > > for (i = 0; i < ngpios; i++) { > - struct device *gpio_dev; > + struct gpio_device *gdev; > + struct device *dev; > struct gpio_desc *gpiod; > enum gpiod_flags flag; > > @@ -195,9 +195,9 @@ static int i2c_mux_gpio_probe(struct platform_device *pdev) > if (!muxc->mux_locked) > continue; > > - /* FIXME: find a proper way to access the GPIO device */ > - gpio_dev = &gpiod->gdev->dev; > - muxc->mux_locked = i2c_root_adapter(gpio_dev) == root; > + gdev = gpiod_to_gpio_device(gpiod); > + dev = gpio_device_to_device(gdev); > + muxc->mux_locked = i2c_root_adapter(dev) == root; > } > > if (muxc->mux_locked) Very nice to see that wart gone! The only small question I have is if these helpers are needed elsewhere, or if a more "direct" gpiod_to_device() would have been sufficient? That said, I have zero problem with this new code as-is, and that detail is of course squarely in gpio-land. Acked-by: Peter Rosin Cheers, Peter