Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1783438rwl; Thu, 30 Mar 2023 01:11:55 -0700 (PDT) X-Google-Smtp-Source: AKy350b2yrquwnr/XmnGONTtKVq4Si4HAcLD2q4MJN+P4zFeRGtDXsaMaGYc5ivsgpezIwRxSIRj X-Received: by 2002:a17:906:190:b0:8eb:fb1a:6970 with SMTP id 16-20020a170906019000b008ebfb1a6970mr343550ejb.1.1680163915431; Thu, 30 Mar 2023 01:11:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680163915; cv=none; d=google.com; s=arc-20160816; b=pvMftt4zxi5t19cMTA4/E3FbqVzGEpu/zOSPyVmil/oO7/7MAaVNU/+3+Z56yq779R ybBHq0NrcTGlJl0EgrYmaIHbr2rZa3XJKCIteKB1tnEhGp4hZr1BHJDVorEH7iGqF1+T yqXo8QaflbfvdMRISuQNtachrPAzE1QlzR+riIZFHOuKsfEdZ1EAIY65tuB/t0/AgRHr t5sACrfOdH7RckZPXcZbodKg/QoPOwDV9sr9eUvkBWAfh7a7gAJBUwYFTOpJ17tituYi 0dstsXYdFM8Qp8Cbtp1FhicrfrVgLZD6nA5vZov4PMiV9TaLGZBkvChVCqis762ccVP+ /SGw== 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:references :cc:to:from:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=/wP52M2xnlem1ysVvkycZnKW6GmRMB71AsDVKGOMpBk=; b=AegTn0rp2Yix3OOa7DCa8tRoT26UIX4WF0Lns676YPjPQ4mP75rDrnYw2yBu0CHAjE 9mAb+OemLXcxC4higPcddajJRh0/bpH27i2ijxarKlZdwi1YbYOEqO78DGUoekdEdjZ4 +FMLjnGSvZbFaMVKNcBoYtdVk0XVUwv6FVIXTNgVMl2higVs4J4LqBD9NrcXrnyk3Spp 7H/gfuCkCQ2cyh+VfZIVs/xy8pVAxjwohUqHuvcJ3fmqxB930tEJu5B/OOvt6gk6BICL uil2PtwamSUDCJTBUkZZNm+qezSaPN0K8c2ZzwZdoHFTe6USatN/DG09bKLfufDjpjjN jz0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tOosVUxX; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ss23-20020a170907c01700b0093e18eb3d2bsi17998342ejc.939.2023.03.30.01.11.28; Thu, 30 Mar 2023 01:11:55 -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=@linaro.org header.s=google header.b=tOosVUxX; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230135AbjC3IHL (ORCPT + 99 others); Thu, 30 Mar 2023 04:07:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230118AbjC3IHI (ORCPT ); Thu, 30 Mar 2023 04:07:08 -0400 Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED7B01A7 for ; Thu, 30 Mar 2023 01:07:06 -0700 (PDT) Received: by mail-lj1-x230.google.com with SMTP id z42so18709097ljq.13 for ; Thu, 30 Mar 2023 01:07:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680163625; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=/wP52M2xnlem1ysVvkycZnKW6GmRMB71AsDVKGOMpBk=; b=tOosVUxXWsUiu1apm/6HlpSjhtiaXJHDAF1Em1UsTGAimLisFooCIZcn6niHf5rg1V WfldBse/bniQEVZVKIpTQLsmo10P1IeZQxHoo90wIbxAeAJujXRBehWI+/NeRYpoSCls x8Hi+SqWAp3wLgfu6wgFTxwjgry8OwpCiHH6r0vzzXzgS2nDKq8NzeKhKn2lU561EFTk VDYdcQNO3zofOMoTcyvXHWAgU5ER+Ym6tXMCZUlIUtOw2dDJ4WfyB1fV9AvxnN2MFols dheeamVynlKhB6zNgSfynIPp8jFvw6BYjzs/JiyAqmW/hZH3iKGxEN/89piZO2/RGjbJ VrtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680163625; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/wP52M2xnlem1ysVvkycZnKW6GmRMB71AsDVKGOMpBk=; b=71N+iA4vT2k54R75kRapBMouTGcVaTy9V0STz8oiyy8IrQx9ax6mrOce6+/ntgFpZ3 I1boPcOoO9V2tvWNrkGlGECX8awxIZMLb2TvhZLueqIKToOFa66QH+rjG7BmGmINe4X6 pKwx1bR6kIvPv5mLveFp/9QCk7Y+DKZYrduuWDQ8nDmt9fp8QspBaTOpj7+3l8fRxAsP GOLwCPqwLBxC5DEx+GBh5zQnnyD3DunR0lK684/xIkKUTP6e3rrXTtPi8Br9gjToZGJV 6OQhMpHUHYa6Bswt+yDv2qR5JAEEx5R+2jQ72T4J3TVyQhYmvm6b9u5KNJbwROCa69wI xidw== X-Gm-Message-State: AAQBX9frJWVcocdyCzkOfSZRDIZ0FzQsCatM1Bnf10XeCdMJTMNjcXGh wGFFof+1XC471l+DahwXNQNLCg== X-Received: by 2002:a05:651c:83:b0:298:b161:feb0 with SMTP id 3-20020a05651c008300b00298b161feb0mr6245507ljq.49.1680163625221; Thu, 30 Mar 2023 01:07:05 -0700 (PDT) Received: from [192.168.0.21] (78-11-189-27.static.ip.netia.com.pl. [78.11.189.27]) by smtp.gmail.com with ESMTPSA id s26-20020a2e9c1a000000b00298dc945e9bsm5778851lji.125.2023.03.30.01.07.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 30 Mar 2023 01:07:04 -0700 (PDT) Message-ID: Date: Thu, 30 Mar 2023 10:07:03 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH v6 5/5] mfd: max77541: Add ADI MAX77541/MAX77540 PMIC Support Content-Language: en-US From: Krzysztof Kozlowski To: Lee Jones , Andy Shevchenko Cc: "Sahin, Okan" , Rob Herring , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Jonathan Cameron , Lars-Peter Clausen , Cosmin Tanislav , Stephen Boyd , Caleb Connolly , Lad Prabhakar , "Bolboaca, Ramona" , ChiYuan Huang , "Tilki, Ibrahim" , William Breathitt Gray , Arnd Bergmann , ChiaEn Wu , Haibo Chen , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-iio@vger.kernel.org" References: <20230307112835.81886-1-okan.sahin@analog.com> <20230307112835.81886-6-okan.sahin@analog.com> <20230315175223.GI9667@google.com> <20230315175257.GJ9667@google.com> <20230329143615.GS2673958@google.com> <20230329145636.GV2673958@google.com> <20230329150605.GW2673958@google.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, 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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 30/03/2023 10:04, Krzysztof Kozlowski wrote: > On 29/03/2023 17:06, Lee Jones wrote: >> On Wed, 29 Mar 2023, Lee Jones wrote: >> >>> On Wed, 29 Mar 2023, Andy Shevchenko wrote: >>> >>>> On Wed, Mar 29, 2023 at 03:36:15PM +0100, Lee Jones wrote: >>>>> On Tue, 28 Mar 2023, Sahin, Okan wrote: >>>>>>> On Wed, 15 Mar 2023, Lee Jones wrote: >>>>>>>> On Tue, 07 Mar 2023, Okan Sahin wrote: >>>> >>>> ... >>>> >>>>>> +static const struct i2c_device_id max77541_i2c_id[] = { >>>>>> + { "max77540", (kernel_ulong_t)&chip[MAX77540] }, >>>>>> + { "max77541", (kernel_ulong_t)&chip[MAX77541] }, >>>>> >>>>> Just 'MAX77540' is fine. >>>> >>>> I tend to disagree. >>>> >>>> There is an error prone approach esp. when we talk with some functions >>>> that unifies OF/ACPI driver data retrieval with legacy ID tables. >>>> In such a case the 0 from enum is hard to distinguish from NULL when >>>> the driver data is not set or not found. On top of that the simple integer >>>> in the legacy driver data will require additional code to be added in >>>> the ->probe(). >>> >>> Use a !0 enum? >>> >>> The extra handling is expected and normal. >> >> I've always disliked mixing platform initialisation strategies. Passing >> pointers to MFD structs through I2C/Device Tree registration opens the >> doors to all sorts of funky interlaced nonsense. >> >> Pass the device ID and then match in C-code please. > > I agree. Especially that casting through ulong_t drops the const, so the > cast back needs const which can be forgotten. The patch already makes > here mistake! Uh, no, the code is correct - chip_info member is const. Yet it is a mistake easy to make for the device ID tables using void * or ulong. Best regards, Krzysztof