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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 316CDC433EF for ; Tue, 2 Nov 2021 16:37:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1F64861101 for ; Tue, 2 Nov 2021 16:37:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231855AbhKBQjf (ORCPT ); Tue, 2 Nov 2021 12:39:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:40406 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235042AbhKBQir (ORCPT ); Tue, 2 Nov 2021 12:38:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635870936; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Zq/1+DwBXNQ+10dXmUih1iaLiLYP5xeOcEC+C1MZoN8=; b=JD/p/8OhjQMWQrlfBz3aSYilpNVjCACmG6nFGvBbqhFcScrKKPC5H3Tquk0daUofsQxSq+ C9kQYufueHZIjsk1p0esI3hTfFEGpEJLXfsQ1SHAxQCvLA+K8oPxPEJnYCrwUB9amcyXDm CN5o9VEOhlxH1eU0YEDYwrLk4SPeI50= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-204-Di8Fk7nEN6GLmZpBfeA4Jw-1; Tue, 02 Nov 2021 12:35:35 -0400 X-MC-Unique: Di8Fk7nEN6GLmZpBfeA4Jw-1 Received: by mail-ed1-f70.google.com with SMTP id o22-20020a056402439600b003dd4f228451so19361618edc.16 for ; Tue, 02 Nov 2021 09:35:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=Zq/1+DwBXNQ+10dXmUih1iaLiLYP5xeOcEC+C1MZoN8=; b=Wjd0IxMEQN/JUdJlXCvPAJrHwKgn3Jh5PFyItvT0YF6K+IZrRoEmJcAeh3MvZtXy9i CpdTNhKGBwadW1GBXTOQU3sg93/4WoOaSNGQ1tsXHV3RIMJ6hPpj8EiLM0e28C6XZshy pdjQDYQ6NiiQ/3Bl9Z4O9beED6ITrfLO0TKOIfshtRll5NubbuJmAqQJyYKKeR4jDKgZ sKHT+8VO7b65QC1yICM6Q67BBv6oeOMxe+ct/fyQ6dAm4ApLMyG56Dyy2oEEcjVQ1Jcf u0tIwSdFFowXAxP4A7xuA0PP6KMVJW1k53IkyXz52Li2T+Qe17EMto+t/rmfYGdZUm2c nUlg== X-Gm-Message-State: AOAM530GlnyNcbdaflh0+EspwC35/doiZGh6HNcD7rn7x+G7jOMwUidZ n7RrZiUsJokxGKYNJYXrtvz2+z137YJe37BALMfxKpgIJubIaBgPiXr6x08QwDNq06fNXcXHtSI 9QakuyikvZgNbtmsvVCM5Dvpl X-Received: by 2002:a05:6402:42ce:: with SMTP id i14mr51371777edc.276.1635870934128; Tue, 02 Nov 2021 09:35:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZ3/uj2tKBojwj8TODwyc/o2fUAP67S0ubiS8nI4mwEt6KxH9DG1zYZPSLje6xVryW/hO80w== X-Received: by 2002:a05:6402:42ce:: with SMTP id i14mr51371745edc.276.1635870933972; Tue, 02 Nov 2021 09:35:33 -0700 (PDT) Received: from ?IPV6:2001:1c00:c1e:bf00:1054:9d19:e0f0:8214? (2001-1c00-0c1e-bf00-1054-9d19-e0f0-8214.cable.dynamic.v6.ziggo.nl. [2001:1c00:c1e:bf00:1054:9d19:e0f0:8214]) by smtp.gmail.com with ESMTPSA id r18sm29563eje.90.2021.11.02.09.35.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 02 Nov 2021 09:35:33 -0700 (PDT) Message-ID: <8d0821c9-b9d2-66de-ca2b-25525e26c67a@redhat.com> Date: Tue, 2 Nov 2021 17:35:32 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: [PATCH v5 10/11] platform/x86: int3472: Pass tps68470_regulator_platform_data to the tps68470-regulator MFD-cell Content-Language: en-US To: Sakari Ailus Cc: Andy Shevchenko , "Rafael J . Wysocki" , Mark Gross , Andy Shevchenko , Wolfram Sang , Mika Westerberg , Daniel Scally , Laurent Pinchart , Mauro Carvalho Chehab , Liam Girdwood , Mark Brown , Michael Turquette , Stephen Boyd , Len Brown , ACPI Devel Maling List , Platform Driver , Linux Kernel Mailing List , linux-i2c , Kate Hsuan , Linux Media Mailing List , linux-clk References: <20211102094907.31271-1-hdegoede@redhat.com> <20211102094907.31271-11-hdegoede@redhat.com> <1f4377bb-2902-05e9-95c7-ad924477b543@redhat.com> From: Hans de Goede In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 11/2/21 17:17, Sakari Ailus wrote: > On Tue, Nov 02, 2021 at 03:59:41PM +0100, Hans de Goede wrote: >> Hi, >> >> On 11/2/21 15:34, Andy Shevchenko wrote: >>> On Tue, Nov 2, 2021 at 11:50 AM Hans de Goede wrote: >>>> >>>> Pass tps68470_regulator_platform_data to the tps68470-regulator >>>> MFD-cell, specifying the voltages of the various regulators and >>>> tying the regulators to the sensor supplies so that sensors which use >>>> the TPS68470 can find their regulators. >>>> >>>> Since the voltages and supply connections are board-specific, this >>>> introduces a DMI matches int3472_tps68470_board_data struct which >>>> contains the necessary per-board info. >>>> >>>> This per-board info also includes GPIO lookup information for the >>>> sensor IO lines which may be connected to the tps68470 GPIOs. >>> >>> ... >>> >>>> + board_data = int3472_tps68470_get_board_data(dev_name(&client->dev)); >>>> + if (!board_data) { >>>> + dev_err(&client->dev, "No board-data found for this laptop/tablet model\n"); >>>> + return -ENODEV; >>> >>> It's fine to use dev_err_probe() for known error codes. >>> >>>> + } >>> >>> ... >>> >>>> + cells[1].platform_data = (void *)board_data->tps68470_regulator_pdata; >>> >>> Do we need casting? >> >> Yes, the cast casts away a "const", the const is correct >> since the data only ever gets read by the regulator driver, >> but platform_data pointers are normally not const, so it >> is either the cast, or loose the const on the definition >> of the struct to which board_data->tps68470_regulator_pdata >> points... >> >> So not good choice here really, only chosing between bad >> options and I picked the lets do the cast "least worse" >> option (at least to me). I'm open to changing this. > > Maybe a comment explaining this briefly? Yes, I was thinking the same myself, I'll add this for the next version (which I expect to be the final version). Regards, Hans