Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp63241pxb; Mon, 8 Nov 2021 09:47:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJwwZNR+kqtVRf2jNKhkWpt6qqDTNHrHVdbqcjhYj3qT6njmrKeKXOZ9SkaTeen10t6dlPuv X-Received: by 2002:a05:6602:164a:: with SMTP id y10mr607284iow.143.1636393621848; Mon, 08 Nov 2021 09:47:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636393621; cv=none; d=google.com; s=arc-20160816; b=QrBbzxCp/oPGV7vbzS9JdrAtMALDGSpr7zC25j64FB+udHMImhYGho40pEH67ae3Qj to9UUKd2S7hzuv/CqDZZ4eoYOKlc5I+uSEG6PCG2BBEX+wb83osCkLQ1xQQecNj3XBsj 1nXKiDcLx8TW02FyLDLmKVqvS8M1KBqkrb8tzE93JS/k05LL5QZv1z6QQGkkf8IfY8Ur vWRRWH/xP+v+az5OcDMwEitrnDSoGw/7MzH33tyr8Z9vC36HnxA6bpc+E2+RGzO8CcBz gQLSbPem8oeVGY2G7+xlNWZq11LP0Z0PN4GUi2MPPDCcQ1ioG0ABfozTjM/ZT62UWB9h xP/A== 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:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=y1FCpwnoXru8LCUd4AbjW/RHjevdkDPK2hMhE65LRpk=; b=EVUAbK4BtUE9D5KQxfjmAl6qHQr/hPxNiJiOvfXGqTnregixEN0gAhPmrjU/wfeGs1 8Tw6BsOLBMiPM6onOSiDLpC+dbyzM+RBY2FELiItv3iu7aN9m/5x8TaKF+7QsuP3IGGA wuYW3ug9O30sUAaUjg4fE3OQI+kV46jJEji3O+njJ77qhhOOwxxxd3mHv7HZCwPmNif2 KFrR6RsBbvc3X/wWrbjLuTDinuI7k9uv79xW3Qu6kA5KyPBsrBXb9xoYYK3mgl65Fubl ID/nksWFD1QKaMU4dN+KYOUHlQ6JyGVybovNNQHi/FtD9AB4MWerEfuwccWhi4NFk13n ogOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EYIAf2ZW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l13si37921401jaj.81.2021.11.08.09.46.18; Mon, 08 Nov 2021 09:47:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EYIAf2ZW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239509AbhKHQJj (ORCPT + 99 others); Mon, 8 Nov 2021 11:09:39 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:28004 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239246AbhKHQJi (ORCPT ); Mon, 8 Nov 2021 11:09:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636387614; 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=y1FCpwnoXru8LCUd4AbjW/RHjevdkDPK2hMhE65LRpk=; b=EYIAf2ZWNP7cYGOtHBFD+XOv6j8eSDzivSBqQuaHMvMIgEynjerB3lg1EE/zox2ERpotiK eXRdhRhpilfG10ncU4btPIswAayW+l+bE08B7bp5xgU4Hep6KkMmQV0Ztx7OYdMH3Yuxxg bPuOWITDt8iMvZOUpGDKniVQvdjkXZo= 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-75-7aR7LczwNBy9kSYWvza02A-1; Mon, 08 Nov 2021 11:06:52 -0500 X-MC-Unique: 7aR7LczwNBy9kSYWvza02A-1 Received: by mail-ed1-f70.google.com with SMTP id d11-20020a50cd4b000000b003da63711a8aso15217497edj.20 for ; Mon, 08 Nov 2021 08:06:52 -0800 (PST) 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=y1FCpwnoXru8LCUd4AbjW/RHjevdkDPK2hMhE65LRpk=; b=C8qJA9dF0zVWQDOjuvJZeAuRpQyjm6G65lrOzpUrIsN09EWXEFowulv5cveJFsxIUB ol4nUW2ZLlQ+DyPengN1fU31RwN2l2C+0QF5TN8tOf74ytmBe18JPUNTporByGRC3ay6 cnypmPCqyCw2hwZIVMip9+1XL68MVFhg1XcshTrl3K3SoI84HzxZRJGPVg/PCBlFqkb/ cWDsIXr+XVR3WHNg8lxsRSWvEpW0t606gZv3MUwuxGK1gd6sISm8Mpri8iyhzxzbhdvj qm458IlJGNYzkBq5rstjLcWuEDUpvW9oBRphNlBGSxfSvzpI2pEBQQG/GWKWTAVSJG1U irPw== X-Gm-Message-State: AOAM5333PBdHqatKyraD6cfcPKRlbe0ds/YdhWwj/yu6y5hdkIgZn3Ae VipM9Vu46G7za/iddOo5KBs7aP2IndO2cZasnhZepVAp4VvMMeigvtP7w9RvIxIA8pX/fPWkWZw kR36zAzjOWb/iz1IrhYzA222w X-Received: by 2002:a05:6402:42d3:: with SMTP id i19mr351693edc.82.1636387611543; Mon, 08 Nov 2021 08:06:51 -0800 (PST) X-Received: by 2002:a05:6402:42d3:: with SMTP id i19mr351664edc.82.1636387611366; Mon, 08 Nov 2021 08:06:51 -0800 (PST) Received: from [10.40.1.223] ([81.30.35.201]) by smtp.gmail.com with ESMTPSA id q8sm3675287edd.26.2021.11.08.08.06.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 08 Nov 2021 08:06:50 -0800 (PST) Message-ID: <6ffd2b8c-00f4-211e-de57-23d5159ae7d4@redhat.com> Date: Mon, 8 Nov 2021 17:06:50 +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 10/13] power: supply: bq25890: Add support for registering the Vbus boost converter as a regulator Content-Language: en-US To: Andy Shevchenko Cc: Mark Gross , Andy Shevchenko , Wolfram Sang , Sebastian Reichel , MyungJoo Ham , Chanwoo Choi , Ard Biesheuvel , Yauhen Kharuzhy , Tsuchiya Yuto , Platform Driver , linux-i2c , Linux PM , Linux Kernel Mailing List , linux-efi References: <20211030182813.116672-1-hdegoede@redhat.com> <20211030182813.116672-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 10/31/21 00:13, Andy Shevchenko wrote: > On Sat, Oct 30, 2021 at 9:28 PM Hans de Goede wrote: >> >> The bq25890_charger code supports enabling/disabling the boost converter >> based on usb-phy notifications. But the usb-phy framework is not used on >> all boards/platforms. At support for registering the Vbus boost converter >> as a standard regulator when there is no usb-phy on the board. >> >> Also add support for providing regulator_init_data through platform_data >> for use on boards where device-tree is not used and the platform code must >> thus provide the regulator_init_data. > > ... > >> @@ -1018,6 +1059,21 @@ static int bq25890_probe(struct i2c_client *client, >> INIT_WORK(&bq->usb_work, bq25890_usb_work); >> bq->usb_nb.notifier_call = bq25890_usb_notifier; >> usb_register_notifier(bq->usb_phy, &bq->usb_nb); >> +#ifdef CONFIG_REGULATOR >> + } else { >> + struct bq25890_platform_data *pdata = dev_get_platdata(dev); >> + struct regulator_config cfg = { }; >> + struct regulator_dev *reg; >> + >> + cfg.dev = dev; >> + cfg.driver_data = bq; >> + if (pdata) >> + cfg.init_data = pdata->regulator_init_data; >> + >> + reg = devm_regulator_register(dev, &bq25890_vbus_desc, &cfg); >> + if (IS_ERR(reg)) >> + return dev_err_probe(dev, PTR_ERR(reg), "registering regulator"); >> +#endif >> } > > } > #ifdef > else { > ... > } > #endif > > is a bit better to maintain (less error prone in case of new code). > > ... > >> +#ifndef _BQ25890_CHARGER_H_ >> +#define _BQ25890_CHARGER_H_ > >> +#include > > struct regulator_init_data; > > should be sufficient, no header is needed. Thanks, I've fixed both for v2 of the patch-set. Regards, Hans > >> +struct bq25890_platform_data { >> + const struct regulator_init_data *regulator_init_data; >> +}; >> + >> +#endif >