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 21B0BC433F5 for ; Tue, 2 Nov 2021 14:59:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0581061105 for ; Tue, 2 Nov 2021 14:59:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233673AbhKBPCY (ORCPT ); Tue, 2 Nov 2021 11:02:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:36696 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233661AbhKBPCU (ORCPT ); Tue, 2 Nov 2021 11:02:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635865185; 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=s2qlvsp2B/ajzGnaxNanhBYqk1Fo8lMuMvQWyew1YE4=; b=R5MDtdtCnUXB4MhBXt08sdLBchpzq9Jqrl98/HHZ0PkgCpUWJ9HkK5q98I96+Z39SpzWER VGlAETlFqnqWx2ao+NYjTQrVUXzlaVxXSscdMvDFhr+YMrlhvq9mLZ7wJFPTLgBPdUap/i 1ktqiv5Wmvbr6hgXrhuzeqeNskUDPK0= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-554-NaJ4KeLRMPOMOjpay5r8sw-1; Tue, 02 Nov 2021 10:59:44 -0400 X-MC-Unique: NaJ4KeLRMPOMOjpay5r8sw-1 Received: by mail-ed1-f72.google.com with SMTP id t20-20020a056402525400b003e2ad6b5ee7so229197edd.8 for ; Tue, 02 Nov 2021 07:59:44 -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=s2qlvsp2B/ajzGnaxNanhBYqk1Fo8lMuMvQWyew1YE4=; b=5Vg5F0p1pwgblprNdThccQM6NOppcIsCswP4WBaugYMCA1YiJm7yeD/JIqUB3iRqUt 9qHZNbSFPJU4c+zjHDOjW3CDo1SrDsOB5g4LB5AJAAx+7VWgOyjNageJLjTaYO4AOFu/ ZKcqexocfMvhEy+RJQCtPaHjDd8f1I+85J8xsWNlqOiMJnM0Vt5aN+TMWs8jzkJEWTPu VoWoU+H7uFhXDa5Qudoo3akXkDn5SPttnIoJ3wsWBuEmGPTvZQ5mf/WF7YBuRTj1W1kE 7ZhbG4ew8YU2WFJhJnVpiBCBvGeXYRPETJPm7bAleGoZntaHny86se9pLKwmH3386sCs IcTw== X-Gm-Message-State: AOAM530FVYBVSg54Ho/TkRlZdH4CnvzXIqkZjWGi0VoJdRIhl+O6Nvhh JQxVHk7QJj18RXpxFTdEy1crF5fGQR5gPhA8CkC+OUP9R3LIYrVTFqcQ4vHe7BXrVH05tV5Nt0O ZuacSFkC3Vc2PCUIiaJ2xbrMW X-Received: by 2002:a17:906:c283:: with SMTP id r3mr25294490ejz.138.1635865183288; Tue, 02 Nov 2021 07:59:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKFQbu2utF1Nmvh8J5nGyiXWxLqQwUpuqFEbRaoqq44byXxZI0wBMOszsSdo8mNls2SFQ1cw== X-Received: by 2002:a17:906:c283:: with SMTP id r3mr25294449ejz.138.1635865183026; Tue, 02 Nov 2021 07:59:43 -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 bm2sm9241694edb.39.2021.11.02.07.59.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 02 Nov 2021 07:59:42 -0700 (PDT) Message-ID: <1f4377bb-2902-05e9-95c7-ad924477b543@redhat.com> Date: Tue, 2 Nov 2021 15:59:41 +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: Andy Shevchenko Cc: "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 , Sakari Ailus , Kate Hsuan , Linux Media Mailing List , linux-clk References: <20211102094907.31271-1-hdegoede@redhat.com> <20211102094907.31271-11-hdegoede@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 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. > ... > >> +#include >> +#include >> +#include >> +#include > > string.h for strcmp() ? > kernel.h for ARRAY_SIZE() ? Ack. Regards, Hans