Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F941C433F5 for ; Thu, 18 Nov 2021 09:48:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1339A6137B for ; Thu, 18 Nov 2021 09:48:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245275AbhKRJva (ORCPT ); Thu, 18 Nov 2021 04:51:30 -0500 Received: from mail-eopbgr30134.outbound.protection.outlook.com ([40.107.3.134]:37029 "EHLO EUR03-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S245260AbhKRJvW (ORCPT ); Thu, 18 Nov 2021 04:51:22 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d7GC+JlPmkdQez3ibwqp6SSIRb6TYA3JfmsAuGFyPpOX+bf8xKeZfs5fgCJCXHM2sb/ebmnqzlaZPIR63FibZMfO/XeicDOy0iGpmLGLd4ovBwBjkmB/bGHT5byRn+aj6IwqjrNSuVVEf3Pq+620OuLriXTI5XxtieSex7TibkDUkY1200hXe40FJlSkDUL982l15E6Yjt38rg7zpTd4iqTwcVdYEheewHlyqp9HeCC2KsVJZpnqr91nTNQoPES4f0v0GMU61CQlobb7dOeulOmYf/li1AYeEuz+jQwVGRk1eiL4UrqJkK104ZutuYddSzM4dFO3qeGYwKs7sulQIQ== 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=zeznbZCY9xcgIXv4DE7RkyHCHtX4LiCNMUM4GYug3CY=; b=ABXPMl5eB3yAnyobQynPq0f5TLHpNPPBynFbonqRiBQBEYJRrYw2HsbOoS26A6YC6quY8OyP1vXHbXfP4UbsA5I90ptr5Jz905ALB7NiXiR33yFxdfhE1mhA0XZLIQMDzlHe2wYdeQATHuvd0+PLd4vcIYCk+QX+qjNkp3GY2ODb2EIQXwx0Cbv33PwTIU8RGLdAHHOOsjDvKao7865ZrUqWgK/Mqai4PMBUFvAuUzBuEcd/vTk7DdNABc53T6CO31aZZ1BbaW0ljvZBlXmXg0M6ppSd0qRik5VF/l2TuCLM7jHamikS0UpeMOQJO3l6DdEqW9zrCf95YNrmoY/fqw== 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=zeznbZCY9xcgIXv4DE7RkyHCHtX4LiCNMUM4GYug3CY=; b=HDZcpK+FnCySCUPIHuP73w3em5vobldTqhs0AANdN3npouQTfSSPwLdw8YWR7eh6EnuVTqa4g1Qk6knFYn0bp3CraUMdunw2Kw+A0c15B66Sqfm8THqhEALKDIZ//kz+s8acWAGh9rZPQIiDVPrOo/jhZ9G044IIt1p87fKacds= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=axentia.se; Received: from DB8PR02MB5482.eurprd02.prod.outlook.com (2603:10a6:10:eb::29) by DB6PR02MB3063.eurprd02.prod.outlook.com (2603:10a6:6:1d::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.27; Thu, 18 Nov 2021 09:48:20 +0000 Received: from DB8PR02MB5482.eurprd02.prod.outlook.com ([fe80::b1d6:d448:8d63:5683]) by DB8PR02MB5482.eurprd02.prod.outlook.com ([fe80::b1d6:d448:8d63:5683%6]) with mapi id 15.20.4690.027; Thu, 18 Nov 2021 09:48:20 +0000 Message-ID: Date: Thu, 18 Nov 2021 10:48:17 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 Subject: Re: [PATCH v1 2/3] i2c: mux: gpio: Don't dereference fwnode from struct device Content-Language: en-US To: Andy Shevchenko , Evan Green , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Peter Korsgaard References: <20211115154201.46579-1-andriy.shevchenko@linux.intel.com> <20211115154201.46579-2-andriy.shevchenko@linux.intel.com> From: Peter Rosin Organization: Axentia Technologies AB In-Reply-To: <20211115154201.46579-2-andriy.shevchenko@linux.intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: GV3P280CA0036.SWEP280.PROD.OUTLOOK.COM (2603:10a6:150:9::23) To DB8PR02MB5482.eurprd02.prod.outlook.com (2603:10a6:10:eb::29) MIME-Version: 1.0 Received: from [192.168.13.3] (185.178.140.238) by GV3P280CA0036.SWEP280.PROD.OUTLOOK.COM (2603:10a6:150:9::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.20 via Frontend Transport; Thu, 18 Nov 2021 09:48:19 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9998f2a4-5206-4013-c84a-08d9aa788dc3 X-MS-TrafficTypeDiagnostic: DB6PR02MB3063: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4502; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: A/pYrOUEqEunmurXCLfB7rcoY2lmytGZtD2Uyw8Ugygn2lPwJbw7F+/6xbr5bnMZh91y4iFdZPQ+YFEptilT8Q9Q5oPplcRbLpJZhRcRQbdHpePsjAT2ZPDxqvSed2dIEUzyzWL34Os46k09jDJZLc7H6c1IjMIpZCy1+R/pNDleFhjSNs167PoPkfcqyQtcdbP+A7yLA41GZQ/601RAeq/Is3NrNCwPAUZ/0O+kT0ehEIoqK26o7uhOK581l8dG7fgmSD13Gx8WrCqac1XeGFV0xw2iI1cEGFl7KQjo+AAW3mPQhdR09n6tDYjQOx2Lr3xTyzsOznoLETHN/xTV6zBsUAD+Dxsg8MYNB7kOBDfHlMO3/rN3ua978FZzTypiIrUznn7+r06uD9a+jjaimndHJVgVdQyv95hlDPGXk4cuPiz2KuqHlP2uIV9ycfJEy3tRERKtGZ9GcY7RnZ/eo+cVGaUmimtYUGLwk8pKekNKSvV25/3XLfoJY8KEofPBkZM4IZCgauanW4rllTh2lz0wJvdOooIxrh1hldf0Jcv9tLLBYPnZUbcXZm1GavVxsmlxKfjxNI+86SOfvMBTo9eC0ECImxJotl30NCyzvUDAEjf6RNjjQGW4KwjZvjek7y/GAIw8njJ3IBc44aY7W8KM8H8DToP93URwmUO92Q+jp6gW1EPCwkeeOz8NW52/LXDql8yaBs91hgiZuPuqh/rUT6F64XnEqnvMTw/LsFIHIIEEUHQHmfzwunXOF9Sn X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB8PR02MB5482.eurprd02.prod.outlook.com;PTR:;CAT:NONE;SFS:(376002)(366004)(396003)(136003)(346002)(39830400003)(66946007)(66556008)(4326008)(66476007)(31696002)(16576012)(26005)(110136005)(83380400001)(53546011)(2906002)(36916002)(86362001)(956004)(508600001)(5660300002)(2616005)(31686004)(4001150100001)(8676002)(38100700002)(6486002)(186003)(36756003)(316002)(8936002)(45980500001)(43740500002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Wk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VFxOFJ2V053eGRwcDNrOHJHSkFpV0lYKzM3?= =?utf-8?B?MU9WeWFoN1pHYkpGVXRZcE9sNkpQMGpsNnREWEFhdDVudXFGZmZSVEZWUXRs?= =?utf-8?B?UGovYWNRYkxqK3orQjI1Q3pHM2JaT3ZOUkw3VHZNWnVQMDQ5L3MwSTQrbjRs?= =?utf-8?B?Y2lJRHJkOWxTQkxxd0dSVFlLaG5Qc3VJYlhGUnpIUHJIZm1oUjFJOERnWVdM?= =?utf-8?B?THJLT0xJUzlaUkVuYVVteldjTks5bUx4QS82bDJERkIzaDcyUVF4NEdlb3k4?= =?utf-8?B?cmw1UlJ3VDVTYVZUZ2xJRXpHQVdhaklvSHBIa293amJVeGJPYi95SWlBbWh1?= =?utf-8?Q?zCp0=3D?= X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-Network-Message-Id: 9998f2a4-5206-4013-c84a-08d9aa788dc3 X-MS-Exchange-CrossTenant-AuthSource: DB8PR02MB5482.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2021 09:48:20.2570 (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: fNLD1VoKN3MCeIHQQjFy7OjXL/Rsjrh+nHJMfdMUmlHMz5U2JV+LeSXL18npZKvv X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR02MB3063 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi! On 2021-11-15 16:42, Andy Shevchenko wrote: > We have a special helper to get fwnode out of struct device. > Moreover, dereferencing it directly prevents the fwnode > modifications in the future. > > Signed-off-by: Andy Shevchenko > --- > drivers/i2c/muxes/i2c-mux-gpio.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/drivers/i2c/muxes/i2c-mux-gpio.c b/drivers/i2c/muxes/i2c-mux-gpio.c > index 31e6eb1591bb..b09c10f36ddb 100644 > --- a/drivers/i2c/muxes/i2c-mux-gpio.c > +++ b/drivers/i2c/muxes/i2c-mux-gpio.c > @@ -53,6 +53,7 @@ static int i2c_mux_gpio_probe_fw(struct gpiomux *mux, > struct platform_device *pdev) > { > struct device *dev = &pdev->dev; > + struct fwnode_handle *fwnode = dev_fwnode(dev); > struct device_node *np = dev->of_node; It feels like there is opportunity to get rid of np, but I suppose that can be done later... Acked-by: Peter Rosin Cheers, Peter > struct device_node *adapter_np; > struct i2c_adapter *adapter = NULL; > @@ -60,7 +61,7 @@ static int i2c_mux_gpio_probe_fw(struct gpiomux *mux, > unsigned *values; > int rc, i = 0; > > - if (is_of_node(dev->fwnode)) { > + if (is_of_node(fwnode)) { > if (!np) > return -ENODEV; > > @@ -72,7 +73,7 @@ static int i2c_mux_gpio_probe_fw(struct gpiomux *mux, > adapter = of_find_i2c_adapter_by_node(adapter_np); > of_node_put(adapter_np); > > - } else if (is_acpi_node(dev->fwnode)) { > + } else if (is_acpi_node(fwnode)) { > /* > * In ACPI land the mux should be a direct child of the i2c > * bus it muxes. > @@ -111,7 +112,7 @@ static int i2c_mux_gpio_probe_fw(struct gpiomux *mux, > } > mux->data.values = values; > > - if (fwnode_property_read_u32(dev->fwnode, "idle-state", &mux->data.idle)) > + if (device_property_read_u32(dev, "idle-state", &mux->data.idle)) > mux->data.idle = I2C_MUX_GPIO_NO_IDLE; > > return 0; >