Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp404149ybc; Tue, 19 Nov 2019 03:20:02 -0800 (PST) X-Google-Smtp-Source: APXvYqwwDlQ2M61IcMHHntIpliIpQkiET3Q5pb/DwTsmDBucIoTrkBiGZ6qHJBCdTEHugr8qyoF2 X-Received: by 2002:a17:906:5251:: with SMTP id y17mr35178358ejm.108.1574162402278; Tue, 19 Nov 2019 03:20:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574162402; cv=none; d=google.com; s=arc-20160816; b=q2OiI9zjhsIVJtRGaHKnFLYEbb3Nj1hGQolJ95FL7W8DuGumviAsmdJt2E5ArNIyhO bnAKqsMmtleCqJaivIaYoz6/Zw0K9hvnLPXYwz3sGJ70ug0+NFdMeo7grDtCTAq0YZ54 iJmXIoV4mQWbCErNiuU9tWIFhOO0tXuGaUXqyBmcUv0RkM8xPJ26oxHnA8tEgF3Lewn2 AQ3LQP0UXZNDzU0QW0OO9NJvTFMg1G/sTNnVRrbTioNQBGiZX2f7z/xX87n45osS+E1O +WWdLpV2TxvhZ4R9w3WEFEkj46xzPwJhjYtHRGgwYElO1PXuyNl/c/I47qCT3km7EPjM +tEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=TLz55deBTOPUc26gtut2U7xNXx6/No2sxu52r3KcQXw=; b=aaB49YGoN0TDuzhJKUmn6GXnNfd08TswK+6bj6RfxlLsVOP/26Z+C3qcr5zMYMXfOo 0AChtU4ZzA2essfcNyuhU8ekPnuq8ZQC9VfxJnXjfbrhL3cjj/GKOfZo3SW0PTgTpqbH S1ot2/uuQrPdsFaFh2fY2w+iD+W9SvrVFTJzkhLA1wkn/cXmw3MWOl1D41XOHIdnDrhC FrbfIagBr+KynXSMrcyvErWnHFwfBt5i8huLcKCi6Dm/Gsyx3MDLoOo8DgA/C5LbGraH YSr9P970+2m//w/8d+hQxs6axM4wk1i43zkYjCT8xvDKRvli21MZZSK0/kdy/FxnIAzt aoQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b="Y7Jb/cKm"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e22si17540653ede.163.2019.11.19.03.19.37; Tue, 19 Nov 2019 03:20:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b="Y7Jb/cKm"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727747AbfKSLPi (ORCPT + 99 others); Tue, 19 Nov 2019 06:15:38 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:43324 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725280AbfKSLPh (ORCPT ); Tue, 19 Nov 2019 06:15:37 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id xAJBEhmG012119; Tue, 19 Nov 2019 11:14:43 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2019-08-05; bh=TLz55deBTOPUc26gtut2U7xNXx6/No2sxu52r3KcQXw=; b=Y7Jb/cKm91JDsBLQ39hghY2OTvQFWWRID7tegmXtpJheNKEYuhaRn9FIHqQbx8uggWcF ujMPiVEWOBY9wvd9P00pivq4Rft7H+AfRfG70K9yzaLH6MNQ5hqS2aB4D8Fjf6+iLSny Iss33Fcr54eF3D2J17CTHqmpdRzMd5/QwrRqVmvJIWobdikdi9/w9kS8L6Bz++CGwB8y bJ1pT0Q0eZQPhg2ZmOBX57hadTwxZSp8lF1kh3jlc7u6/LPyZTj59eYLmgJrOlYckZxI MME7oY/ZuV7a9oHRukpCK/9uQYBgnVa4PSOnrrxyVcn+KyOWFJd1V66kdmTBJoV3pWgU +A== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 2wa92pp519-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 19 Nov 2019 11:14:43 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id xAJBD33V191019; Tue, 19 Nov 2019 11:14:43 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3020.oracle.com with ESMTP id 2wcem8d5cm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 19 Nov 2019 11:14:43 +0000 Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id xAJBEcJ1005137; Tue, 19 Nov 2019 11:14:38 GMT Received: from kadam (/41.210.141.188) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 19 Nov 2019 03:14:36 -0800 Date: Tue, 19 Nov 2019 14:14:24 +0300 From: Dan Carpenter To: Ravulapati Vishnu vardhan rao Cc: Alexander.Deucher@amd.com, djkurtz@google.com, Akshu.Agrawal@amd.com, Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , "moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." , open list Subject: Re: [PATCH v8 1/6] ASoC: amd:Create multiple I2S platform device endpoint Message-ID: <20191119111424.GD5626@kadam> References: <1574155967-1315-1-git-send-email-Vishnuvardhanrao.Ravulapati@amd.com> <1574155967-1315-2-git-send-email-Vishnuvardhanrao.Ravulapati@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1574155967-1315-2-git-send-email-Vishnuvardhanrao.Ravulapati@amd.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9445 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=591 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-1911190105 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9445 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=660 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-1911190106 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 19, 2019 at 03:02:42PM +0530, Ravulapati Vishnu vardhan rao wrote: > static int snd_acp3x_probe(struct pci_dev *pci, > const struct pci_device_id *pci_id) > { > - int ret; > - u32 addr, val; > struct acp3x_dev_data *adata; > - struct platform_device_info pdevinfo; > + struct platform_device_info pdevinfo[ACP3x_DEVS]; > unsigned int irqflags; > + int ret, val, i; val should stay as u32. > + u32 addr; > > if (pci_enable_device(pci)) { > dev_err(&pci->dev, "pci_enable_device failed\n"); > @@ -43,7 +43,7 @@ static int snd_acp3x_probe(struct pci_dev *pci, > GFP_KERNEL); > if (!adata) { > ret = -ENOMEM; > - goto release_regions; > + goto adata_free; Release regions was the correct label name because if you do the goto then it will call release_regions(). > } > > /* check for msi interrupt support */ > @@ -56,7 +56,8 @@ static int snd_acp3x_probe(struct pci_dev *pci, > irqflags = 0; > > addr = pci_resource_start(pci, 0); > - adata->acp3x_base = ioremap(addr, pci_resource_len(pci, 0)); > + adata->acp3x_base = devm_ioremap(&pci->dev, addr, > + pci_resource_len(pci, 0)); > if (!adata->acp3x_base) { > ret = -ENOMEM; > goto release_regions; > @@ -68,11 +69,11 @@ static int snd_acp3x_probe(struct pci_dev *pci, > switch (val) { > case I2S_MODE: > adata->res = devm_kzalloc(&pci->dev, > - sizeof(struct resource) * 2, > + sizeof(struct resource) * 4, > GFP_KERNEL); > if (!adata->res) { > ret = -ENOMEM; > - goto unmap_mmio; > + goto release_regions; > } > > adata->res[0].name = "acp3x_i2s_iomem"; > @@ -80,41 +81,68 @@ static int snd_acp3x_probe(struct pci_dev *pci, > adata->res[0].start = addr; > adata->res[0].end = addr + (ACP3x_REG_END - ACP3x_REG_START); > > - adata->res[1].name = "acp3x_i2s_irq"; > - adata->res[1].flags = IORESOURCE_IRQ; > - adata->res[1].start = pci->irq; > - adata->res[1].end = pci->irq; > + adata->res[1].name = "acp3x_i2s_sp"; > + adata->res[1].flags = IORESOURCE_MEM; > + adata->res[1].start = addr + ACP3x_I2STDM_REG_START; > + adata->res[1].end = addr + ACP3x_I2STDM_REG_END; > + > + adata->res[2].name = "acp3x_i2s_bt"; > + adata->res[2].flags = IORESOURCE_MEM; > + adata->res[2].start = addr + ACP3x_BT_TDM_REG_START; > + adata->res[2].end = addr + ACP3x_BT_TDM_REG_END; > + > + adata->res[3].name = "acp3x_i2s_irq"; > + adata->res[3].flags = IORESOURCE_IRQ; > + adata->res[3].start = pci->irq; > + adata->res[3].end = adata->res[3].start; > > adata->acp3x_audio_mode = ACP3x_I2S_MODE; > > memset(&pdevinfo, 0, sizeof(pdevinfo)); > - pdevinfo.name = "acp3x_rv_i2s"; > - pdevinfo.id = 0; > - pdevinfo.parent = &pci->dev; > - pdevinfo.num_res = 2; > - pdevinfo.res = adata->res; > - pdevinfo.data = &irqflags; > - pdevinfo.size_data = sizeof(irqflags); > - > - adata->pdev = platform_device_register_full(&pdevinfo); > - if (IS_ERR(adata->pdev)) { > - dev_err(&pci->dev, "cannot register %s device\n", > - pdevinfo.name); > - ret = PTR_ERR(adata->pdev); > - goto unmap_mmio; > + pdevinfo[0].name = "acp3x_rv_i2s_dma"; > + pdevinfo[0].id = 0; > + pdevinfo[0].parent = &pci->dev; > + pdevinfo[0].num_res = 4; > + pdevinfo[0].res = &adata->res[0]; > + pdevinfo[0].data = &irqflags; > + pdevinfo[0].size_data = sizeof(irqflags); > + > + pdevinfo[1].name = "acp3x_i2s_playcap"; > + pdevinfo[1].id = 0; > + pdevinfo[1].parent = &pci->dev; > + pdevinfo[1].num_res = 1; > + pdevinfo[1].res = &adata->res[1]; > + > + pdevinfo[2].name = "acp3x_i2s_playcap"; > + pdevinfo[2].id = 1; > + pdevinfo[2].parent = &pci->dev; > + pdevinfo[2].num_res = 1; > + pdevinfo[2].res = &adata->res[2]; > + for (i = 0; i < ACP3x_DEVS ; i++) { > + adata->pdev[i] = > + platform_device_register_full(&pdevinfo[i]); > + if (IS_ERR(adata->pdev[i])) { > + dev_err(&pci->dev, "cannot register %s device\n", > + pdevinfo[i].name); > + ret = PTR_ERR(adata->pdev[i]); > + goto unmap_mmio; > + } > } > break; > default: > dev_err(&pci->dev, "Invalid ACP audio mode : %d\n", val); > ret = -ENODEV; > - goto unmap_mmio; > + goto release_regions; > } > return 0; > > unmap_mmio: > - pci_disable_msi(pci); > - iounmap(adata->acp3x_base); > + if (val == I2S_MODE) > + for (i = 0 ; i < ACP3x_DEVS ; i++) > + platform_device_unregister(adata->pdev[i]); This label used to unmap, but now we're using devm_ so it doesn't any more. Change it to unregister_devices or something. > release_regions: > + pci_disable_msi(pci); This should be "disable_msi" or something. > +adata_free: > pci_release_regions(pci); release_regions: > disable_pci: > pci_disable_device(pci); regards, dan carpenter