Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2661112pxb; Tue, 19 Jan 2021 02:59:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJxbOKyS0WYjMhFn+UauP3WIE6Klr4wpZxlqelNcyz389+fX5qHvESxyZc7rYr5cj+4ZbkRC X-Received: by 2002:a17:907:10c8:: with SMTP id rv8mr2559736ejb.228.1611053957598; Tue, 19 Jan 2021 02:59:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611053957; cv=none; d=google.com; s=arc-20160816; b=UpNkcP0mE2+nEjel8126EozW9822gIHYFnZ3VAlzzR1KbTHtLBogRd39qkROUJXQID oT/+AvmifxmRqKNOXQabuZvoewhG2tQPZGTRmlhyL7whQEo2Rb49BF4IGm/EQHu952tH EhfVYQKlG7VSAl9T/CVmHw1PjUtHzb3SZov82pE7z5kgqzFuF29eekklM80hz4aRgMoN nZjOTua+Td+mdkassa3dQ8a02o0o0GjODOu6jY5jJ4vBURWNPALk1CEI+nPLlTAkl+bY B8cjN53eoZjv3knYVzQCYbFaFkCSAVp0t5oLAK8ulLdBQtTgvxrbB9rd2FRNZREJ9dmh KrzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=ZGcMmV8ud8RsHGVG+9fWIXTvDt1zAVWYEvH2Lib4jVI=; b=qj170XXmrVRWmbN+lPbpntUm5qGoQn8g4Li7KOBQevfqouSAjEPoukpncNqyy0FOkL zFHoY7oPeWwRs8eCmIJl/1xg3kgKwUaZvUB7tUW50uP3MgK3Z+3wam4o3ME5kzZd7QSA MZ/tX9BnlUnf2r9wgGiBASHFEQwR7/vzPzewvkuFiONZDsuGCdhufr+WMAl/RQNBrCl3 11bSk7wYC0hx7CpCmXy5PiEsIVeUcQ1XE0O2j50vuIRuYQ6GsNeXWrVBfEqwGRZ5LaVR e+j/O4bmRhonkTlDNGDhRE54wPtsMTgEDb4GIw4Ux+B1RL6xXwwfRn3vJCezmQ541kZM KPiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=E0FLQ5IM; 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=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s20si8360131eji.387.2021.01.19.02.58.54; Tue, 19 Jan 2021 02:59:17 -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=@cirrus.com header.s=PODMain02222019 header.b=E0FLQ5IM; 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=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732012AbhASKMD (ORCPT + 99 others); Tue, 19 Jan 2021 05:12:03 -0500 Received: from mx0a-001ae601.pphosted.com ([67.231.149.25]:57532 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389159AbhASJwq (ORCPT ); Tue, 19 Jan 2021 04:52:46 -0500 Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 10J9poiF017510; Tue, 19 Jan 2021 03:51:50 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=PODMain02222019; bh=ZGcMmV8ud8RsHGVG+9fWIXTvDt1zAVWYEvH2Lib4jVI=; b=E0FLQ5IMWCry+Mfo6u3aruWZbOGbkgCf5ivhN9bPBatcRSsUC23rbZ/0dEjXNZWThb9w wZi8T0ROP1rZ9E0mqKjoU19GwrVHFtFfF2kcepgO6LuFzeva57UYD/XhAISQIe5olW1I aX5+WU8g/4hur2QF4ISPcjdgXx0WMXdY73NzYedr5dq199O9Nc/gB8FlIuzxEuNjMesX 1+haR7jWn0j9o00um2j/6DXTf3qcTiG9R4Dd986tFzHlG0SSUZt18WM3onJ0vqRZZPV2 j1NNVT/6qMCTI450P9AFWCfKUJbWu8O7Mua0kl1Mdt6XkQq5f9JtANGOtvrXlgOXYF4v 3w== Received: from ediex01.ad.cirrus.com ([87.246.76.36]) by mx0a-001ae601.pphosted.com with ESMTP id 363xe7avy7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Tue, 19 Jan 2021 03:51:50 -0600 Received: from EDIEX01.ad.cirrus.com (198.61.84.80) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Tue, 19 Jan 2021 09:51:48 +0000 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Tue, 19 Jan 2021 09:51:48 +0000 Received: from [10.0.2.15] (AUSNPC0LSNW1.ad.cirrus.com [198.61.64.215]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 84AA311CB; Tue, 19 Jan 2021 09:51:41 +0000 (UTC) Subject: Re: [PATCH v2 08/12] ASoC: arizona-jack: convert into a helper library for codec drivers To: Andy Shevchenko , Hans de Goede CC: Lee Jones , Cezary Rojewski , Pierre-Louis Bossart , Liam Girdwood , Jie Yang , Mark Brown , , Linux Kernel Mailing List , Charles Keepax , ALSA Development Mailing List References: <20210117160555.78376-1-hdegoede@redhat.com> <20210117160555.78376-9-hdegoede@redhat.com> From: Richard Fitzgerald Message-ID: Date: Tue, 19 Jan 2021 09:51:42 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 malwarescore=0 mlxlogscore=937 mlxscore=0 adultscore=0 impostorscore=0 phishscore=0 clxscore=1015 priorityscore=1501 suspectscore=0 spamscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101190059 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 18/01/2021 17:24, Andy Shevchenko wrote: > On Sun, Jan 17, 2021 at 6:06 PM Hans de Goede wrote: >> >> Convert the arizona extcon driver into a helper library for direct use >> from the arizona codec-drivers, rather then being bound to a separate >> MFD cell. >> >> Note the probe (and remove) sequence is split into 2 parts: >> >> 1. The arizona_jack_codec_dev_probe() function inits a bunch of >> jack-detect specific variables in struct arizona_priv and tries to get >> a number of resources where getting them may fail with -EPROBE_DEFER. >> >> 2. Then once the machine driver has create a snd_sock_jack through >> snd_soc_card_jack_new() it calls snd_soc_component_set_jack() on >> the codec component, which will call the new arizona_jack_set_jack(), >> which sets up jack-detection and requests the IRQs. >> >> This split is necessary, because the IRQ handlers need access to the >> arizona->dapm pointer and the snd_sock_jack which are not available >> when the codec-driver's probe function runs. >> >> Note this requires that machine-drivers for codecs which are converted >> to use the new helper functions from arizona-jack.c are modified to >> create a snd_soc_jack through snd_soc_card_jack_new() and register >> this jack with the codec through snd_soc_component_set_jack(). > > ... > >> +int arizona_jack_codec_dev_probe(struct arizona_priv *info, struct device *dev) >> { >> - struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); >> + struct arizona *arizona = info->arizona; >> struct arizona_pdata *pdata = &arizona->pdata; > >> + int ret, mode; >> >> if (!dev_get_platdata(arizona->dev)) >> - arizona_extcon_device_get_pdata(&pdev->dev, arizona); >> + arizona_extcon_device_get_pdata(dev, arizona); >> >> - info->micvdd = devm_regulator_get(&pdev->dev, "MICVDD"); >> + info->micvdd = devm_regulator_get(arizona->dev, "MICVDD"); > > I'm wondering if arizona->dev == dev here. if no, can this function > get a comment / kernel-doc explaining what dev is? > pdev->dev would be *this* driver. arizona->dev should be the MFD parent driver. I think these gets should be against the dev passed in as argument (I assume that is the caller's pdev->dev). So they are owned by this driver, not its parent.