From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B99FFC61DB3 for ; Tue, 10 Jan 2023 08:36:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237953AbjAJIgB (ORCPT ); Tue, 10 Jan 2023 03:36:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231790AbjAJIfp (ORCPT ); Tue, 10 Jan 2023 03:35:45 -0500 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24EE74914B for ; Tue, 10 Jan 2023 00:35:36 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id k22-20020a05600c1c9600b003d1ee3a6289so9212823wms.2 for ; Tue, 10 Jan 2023 00:35:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=iY2kNKoTIXZn2gSTCybP9yJzCdsfQZ3WA/pnwKJAnKY=; b=Uj3oQaHjeYYpzutkftegGDOi1+X0Xm8kuiYk6QJu4Z41fDjcNYu2LJ0pmpa0DtZ1mo zey0AQOqYno52448CqwFWaRPqY0/tpe0uY2b4f6SagaB1myNpvcNt+HlVR5RwBcnMX1z HQ33A1FRZz/lz35GAe2t29DqsmXMJM8h3BSBqbZd0Ozsi0PfHWGXus9NP8rn3szflW9w Np3Ka1VHiQzVaBWP4EVqHrr87eVevHNhhHQMa/VuJJkyk4BoIFTZ9TjLxGndb174vmNV HBbJzvoYI8BIULUu7Kz9wZhQQ15yMEKAjFjgN68/taR84EzOTC4rj1g4ZH9Gbb5RsU1I 3Rhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=iY2kNKoTIXZn2gSTCybP9yJzCdsfQZ3WA/pnwKJAnKY=; b=JbRm9ZeRhJ4U1MPihIDqsckZy/hEWIJHvuIbt77TGmSFUJFHOlQ4kziKnG97mFIu33 AZghWgWgHHdjpTp2yux/WroBtUKaeKy8XcAcXlXoHZZnEWEeWTG+zWkaYcEK9oI+gVvR ZySoRTmMCe91N74o4V72D09UWgKWagXIBWyh3ccWcBv/++dJQ7rm8k0Fw+8eyVtlPUAx vOmj5axeDcLC6ILXCXo5pBGazcuHhHbBLKcy/XayzlFJd66oX2X/EW72Qe3DsLrCTN8O LoN1IGtvY58sIWldZwkImjAEir8+Sumcu+2iwhRiAAKgIGmikFcdcbQK7/UvOriGKVlB Cheg== X-Gm-Message-State: AFqh2kroOCdBj3zIBdQ5IaLog+o4GL0P5cxLOGfkW4tms9OK/LymuFuW 4uV5ufB0wuKSoJsU3q6jUVeXRw== X-Google-Smtp-Source: AMrXdXuAbHhYKCwefQTQIpdarosnfxcUv4i7yZv1WIZFY6OiIxITGjfCUiYlmzSTmiaK+mPkvQryVQ== X-Received: by 2002:a05:600c:4f12:b0:3d9:f492:f25f with SMTP id l18-20020a05600c4f1200b003d9f492f25fmr3521200wmq.16.1673339734712; Tue, 10 Jan 2023 00:35:34 -0800 (PST) Received: from [192.168.1.109] ([178.197.216.144]) by smtp.gmail.com with ESMTPSA id i13-20020adffdcd000000b002a91572638csm10334677wrs.75.2023.01.10.00.35.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 10 Jan 2023 00:35:33 -0800 (PST) Message-ID: Date: Tue, 10 Jan 2023 09:35:32 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH v1 1/6] i2c: hpe: Add GXP SoC I2C Controller Content-Language: en-US To: "Hawkins, Nick" Cc: "Verdun, Jean-Marie" , "robh+dt@kernel.org" , "krzysztof.kozlowski+dt@linaro.org" , "lee@kernel.org" , "linux@armlinux.org.uk" , "linux-i2c@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" References: <20221216183532.78933-1-nick.hawkins@hpe.com> <20221216183532.78933-2-nick.hawkins@hpe.com> <832510cf-0a1d-35cb-8754-7d9c9e94b0a6@linaro.org> <1F4A96B7-F90D-401D-93D8-A14CD8F4E0B7@hpe.com> From: Krzysztof Kozlowski In-Reply-To: <1F4A96B7-F90D-401D-93D8-A14CD8F4E0B7@hpe.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On 09/01/2023 21:23, Hawkins, Nick wrote: >>> + GFP_KERNEL); >>> + if (!drvdata) >>> + return -ENOMEM; >>> + >>> + platform_set_drvdata(pdev, drvdata); >>> + drvdata->dev = &pdev->dev; >>> + init_completion(&drvdata->completion); >>> + >>> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); >>> + drvdata->base = devm_ioremap_resource(&pdev->dev, res); > >> It's one call, not two. Use the respective helper. > > Greetings Krzysztof, > > Thank you for the feedback. I am in the process of applying your recommended > changes but do have a question on this comment. > > I can replace these two lines with: > drvdata->base = devm_platform_ioremap_resource(pdev, 0); > > However, I still have a need for the resource "res" here to determine the physical > address of the device here: > >>> + if (IS_ERR(drvdata->base)) >>> + return PTR_ERR(drvdata->base); >>> + >>> + drvdata->engine = (res->start & 0xf00) >> 8; >>> + pr_info("%s: i2c engine%d\n", __func__, drvdata->engine); Entire pr_info must be gone, so you do not need res anymore. You should not print any addresses. Unless drvdata->engine is used further? In such case you have function just few lines above the one you mentioned, don't you? > > Hence at some point I believe I will still need to call the "platform_get_resource" > function to accomplish this. Is this acceptable or perhaps you have another > suggestion? > > One alternative I thought of was including a property in the device tree node > That specifies which i2c engine this is: hpe,gxp-engine = <1>. Best regards, Krzysztof