From patchwork Fri Aug 2 18:22:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 13751861 Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A12E71A83B9; Fri, 2 Aug 2024 18:23:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.19.141 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722622997; cv=none; b=SGKog8dPE3Vzumue29IGE4bvPH8UDJGt10X1tig2d/pt58UYHrrwt9Y2eo56k17+Mou/tawFIFBMpAZOKfOjjbWn/Yfvggj7WLKRKLY7t1FF1+hAsCDC8e5U0ZDWFoGJQ/pZHV7MAJ6OlnTKj4WRxt05TpHU8y+hbm17AH/kCTs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722622997; c=relaxed/simple; bh=M+ulUkV1YTG068x/Qdy7o5UyxYtRh+kStIOmvFqJrHI=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=JX5sEWuay+E63lSSj438WC6eHYqFDTc0cJGwwSV84ZHfOoqwsbxvP+6dYMmdPnvtFiLU/2grDiiVxHJi1K2PDaUY+Ld7LaRqjbgGmK2zKexZ1Z0FYrXfNytm5uslhk7QqKHcSDzN4H4XWPwr+PzCvJ9mmRjo2fWq9blXQrzi64Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=Nw1VcDDK; arc=none smtp.client-ip=198.47.19.141 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="Nw1VcDDK" Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 472IN1xH069877; Fri, 2 Aug 2024 13:23:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1722622981; bh=QM5oBnyYC3TLRvQQiX0szRRaPNGIEa5CsBev4nNhHDs=; h=From:To:CC:Subject:Date; b=Nw1VcDDK2TsE97UWRYIkAZESGrQ/1PZy+RYVY1uciNeCwRfDqtB9H2KK/4VBOhO5R FbCAp3QZIuSRtOvh6HLpaqhjn0IVTY1zlfhddCbTV7JISq8+IcTNRgmrcm7WaLODO/ lYOHh2lhohrFQVgmz09tdBLTzggEE5gR8/OG6y8E= Received: from DFLE106.ent.ti.com (dfle106.ent.ti.com [10.64.6.27]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 472IN1kI044102 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 2 Aug 2024 13:23:01 -0500 Received: from DFLE115.ent.ti.com (10.64.6.36) by DFLE106.ent.ti.com (10.64.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Fri, 2 Aug 2024 13:23:01 -0500 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Fri, 2 Aug 2024 13:23:01 -0500 Received: from lelvsmtp5.itg.ti.com ([10.249.42.149]) by lelvsmtp6.itg.ti.com (8.15.2/8.15.2) with ESMTP id 472IN0BQ039524; Fri, 2 Aug 2024 13:23:01 -0500 From: Andrew Davis To: Hari Nagalla , Bjorn Andersson , Mathieu Poirier CC: , , Andrew Davis Subject: [PATCH 1/7] remoteproc: keystone: Use devm_kasprintf() to build name string Date: Fri, 2 Aug 2024 13:22:54 -0500 Message-ID: <20240802182300.244055-1-afd@ti.com> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-remoteproc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 This is simpler and removes the need to assume the id length to be 1 digit, which then removes a W=1 compile warning about the same. Signed-off-by: Andrew Davis --- drivers/remoteproc/keystone_remoteproc.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/remoteproc/keystone_remoteproc.c b/drivers/remoteproc/keystone_remoteproc.c index 7e57b90bcaf85..81b179e269a1e 100644 --- a/drivers/remoteproc/keystone_remoteproc.c +++ b/drivers/remoteproc/keystone_remoteproc.c @@ -366,8 +366,6 @@ static int keystone_rproc_probe(struct platform_device *pdev) struct rproc *rproc; int dsp_id; char *fw_name = NULL; - char *template = "keystone-dsp%d-fw"; - int name_len = 0; int ret = 0; if (!np) { @@ -382,11 +380,9 @@ static int keystone_rproc_probe(struct platform_device *pdev) } /* construct a custom default fw name - subject to change in future */ - name_len = strlen(template); /* assuming a single digit alias */ - fw_name = devm_kzalloc(dev, name_len, GFP_KERNEL); + fw_name = devm_kasprintf(dev, GFP_KERNEL, "keystone-dsp%d-fw", dsp_id); if (!fw_name) return -ENOMEM; - snprintf(fw_name, name_len, template, dsp_id); rproc = rproc_alloc(dev, dev_name(dev), &keystone_rproc_ops, fw_name, sizeof(*ksproc)); From patchwork Fri Aug 2 18:22:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 13751865 Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D17741A83DC; Fri, 2 Aug 2024 18:23:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.249 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722622999; cv=none; b=kgijWyPGaB/RP1p5gNdMkEUR/Jkh1QbYvcwlv0EQnIWDQWIZlPMu1DLEv8lWleOj1nRaKegEhn7RpH6AQQmtU+vthtkIHSqNf4WDWMxlXUwc21pOFMov6PbZr3ALJZJANQqG+oMc3ms583v55mGrHVnOrGJHRG1a2HitUtngf2g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722622999; c=relaxed/simple; bh=ADsp1gcUXs+epZoFjGKNfe+dK2qep7UY7Cac/z7UTNs=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VM/kSFgMer/Ke3V+ZkFJ41HZD9ev2Vxx9+o3tXzBHheXXRzF0qgFS35OyQqrUqagGk90fq/iHNt8AhFCPM6Vw1lM/yltKPpdkejUkXvRKctqco59OsgPSrQ0zfVUyVw6YhPGSq8ibye9TJKrnfFij1vIOU8scR/bFCJLHvFuf68= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=cd+WFdRn; arc=none smtp.client-ip=198.47.23.249 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="cd+WFdRn" Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 472IN22f082436; Fri, 2 Aug 2024 13:23:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1722622982; bh=O86ORrK+0y3u81QYelnOZffrcXvpfH/Knc6HX3fOFCs=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=cd+WFdRnfosezt54GJVRnhjrMiyVQ+2P7sZkMOL3CUAEOdctKV73/jlYwfjB8bxaX LWAHwXvyH8EXzJfEx2FF9Wt0lmB61bqQnWYlySvAbYpNXQJykzj2iPvSXaWI6oygDy JPx4K0WZMOjL0qegTf21lheZOLgAP+mbGVTW7tss= Received: from DLEE112.ent.ti.com (dlee112.ent.ti.com [157.170.170.23]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 472IN15J071286 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 2 Aug 2024 13:23:02 -0500 Received: from DLEE103.ent.ti.com (157.170.170.33) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Fri, 2 Aug 2024 13:23:01 -0500 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DLEE103.ent.ti.com (157.170.170.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Fri, 2 Aug 2024 13:23:01 -0500 Received: from lelvsmtp5.itg.ti.com ([10.249.42.149]) by lelvsmtp6.itg.ti.com (8.15.2/8.15.2) with ESMTP id 472IN0BR039524; Fri, 2 Aug 2024 13:23:01 -0500 From: Andrew Davis To: Hari Nagalla , Bjorn Andersson , Mathieu Poirier CC: , , Andrew Davis Subject: [PATCH 2/7] remoteproc: keystone: Use devm_rproc_alloc() helper Date: Fri, 2 Aug 2024 13:22:55 -0500 Message-ID: <20240802182300.244055-2-afd@ti.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240802182300.244055-1-afd@ti.com> References: <20240802182300.244055-1-afd@ti.com> Precedence: bulk X-Mailing-List: linux-remoteproc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Use the device lifecycle managed allocation function. This helps prevent mistakes like freeing out of order in cleanup functions and forgetting to free on error paths. Signed-off-by: Andrew Davis --- drivers/remoteproc/keystone_remoteproc.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/remoteproc/keystone_remoteproc.c b/drivers/remoteproc/keystone_remoteproc.c index 81b179e269a1e..8f0f7a4cfef26 100644 --- a/drivers/remoteproc/keystone_remoteproc.c +++ b/drivers/remoteproc/keystone_remoteproc.c @@ -384,8 +384,8 @@ static int keystone_rproc_probe(struct platform_device *pdev) if (!fw_name) return -ENOMEM; - rproc = rproc_alloc(dev, dev_name(dev), &keystone_rproc_ops, fw_name, - sizeof(*ksproc)); + rproc = devm_rproc_alloc(dev, dev_name(dev), &keystone_rproc_ops, + fw_name, sizeof(*ksproc)); if (!rproc) return -ENOMEM; @@ -396,13 +396,11 @@ static int keystone_rproc_probe(struct platform_device *pdev) ret = keystone_rproc_of_get_dev_syscon(pdev, ksproc); if (ret) - goto free_rproc; + return ret; ksproc->reset = devm_reset_control_get_exclusive(dev, NULL); - if (IS_ERR(ksproc->reset)) { - ret = PTR_ERR(ksproc->reset); - goto free_rproc; - } + if (IS_ERR(ksproc->reset)) + return PTR_ERR(ksproc->reset); /* enable clock for accessing DSP internal memories */ pm_runtime_enable(dev); @@ -467,8 +465,6 @@ static int keystone_rproc_probe(struct platform_device *pdev) pm_runtime_put_sync(dev); disable_rpm: pm_runtime_disable(dev); -free_rproc: - rproc_free(rproc); return ret; } @@ -480,7 +476,6 @@ static void keystone_rproc_remove(struct platform_device *pdev) gpiod_put(ksproc->kick_gpio); pm_runtime_put_sync(&pdev->dev); pm_runtime_disable(&pdev->dev); - rproc_free(ksproc->rproc); of_reserved_mem_device_release(&pdev->dev); } From patchwork Fri Aug 2 18:22:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 13751864 Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E5381A83D9; Fri, 2 Aug 2024 18:23:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.19.141 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722622999; cv=none; b=R0a0JdEeIFR1r6iwiF2V+6uU8EYhimbP4BZRajFo35qAymUApCh8BKt2ZkN8EiASrGhLqLSgEMZ4UksDlFml+mMA++5UzzKMW0ljEbES6VQLkvM2akxCIbiI3WErq74H7aPV2bEzLEyb/QLp5UxwyyLKWlooRSGaC8yMrA8BihY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722622999; c=relaxed/simple; bh=8eHj5W2I1B7lPIs7Ayzn9zXsvBeLW03zfffBi42QYq4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=sAll9ZdZK+zGvBOmFvlVCM6duWsGlpC4FtdaVFq+v9/BfeoWLCAPMOaIxRJOXd0O62ElXtxm1bq4Ft5kd/DJjZb8PPYOjczymtdtq9YfQMugbsP9CgyAdqU4UYhkvUxsVHXTdrSfBbxMsiybEOm6DoezE2DwRcFMTvDd48HNkDk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=IO/HqWAH; arc=none smtp.client-ip=198.47.19.141 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="IO/HqWAH" Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 472IN2c0069881; Fri, 2 Aug 2024 13:23:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1722622982; bh=Umy8kAGBBEHNE3RH/Ztc9B7WnVg4TGbetmOyidvtuP8=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=IO/HqWAHBrF5KAtOIKKeEwRdfHB6IQayIQsWMPYjfHQI2wVFO7NDs2uxi9KaDeM3l C56Pu/g+VRbEpXWKyTXLAFbFmTK1ncHaGsXYo1WYPo/PHcjfG1FgO5g09BnFH7v66S DuJ6E5WQEJLXSrniw8iKd3lSh70zz4ZXYKcyRhr0= Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 472IN2NF079401 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 2 Aug 2024 13:23:02 -0500 Received: from DLEE102.ent.ti.com (157.170.170.32) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Fri, 2 Aug 2024 13:23:01 -0500 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DLEE102.ent.ti.com (157.170.170.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Fri, 2 Aug 2024 13:23:01 -0500 Received: from lelvsmtp5.itg.ti.com ([10.249.42.149]) by lelvsmtp6.itg.ti.com (8.15.2/8.15.2) with ESMTP id 472IN0BS039524; Fri, 2 Aug 2024 13:23:01 -0500 From: Andrew Davis To: Hari Nagalla , Bjorn Andersson , Mathieu Poirier CC: , , Andrew Davis Subject: [PATCH 3/7] remoteproc: keystone: Use devm action to release reserved memory Date: Fri, 2 Aug 2024 13:22:56 -0500 Message-ID: <20240802182300.244055-3-afd@ti.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240802182300.244055-1-afd@ti.com> References: <20240802182300.244055-1-afd@ti.com> Precedence: bulk X-Mailing-List: linux-remoteproc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 This helps prevent mistakes like freeing out of order in cleanup functions and forgetting to free on error paths. Signed-off-by: Andrew Davis --- drivers/remoteproc/keystone_remoteproc.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/remoteproc/keystone_remoteproc.c b/drivers/remoteproc/keystone_remoteproc.c index 8f0f7a4cfef26..033e573544fef 100644 --- a/drivers/remoteproc/keystone_remoteproc.c +++ b/drivers/remoteproc/keystone_remoteproc.c @@ -358,6 +358,13 @@ static int keystone_rproc_of_get_dev_syscon(struct platform_device *pdev, return 0; } +static void keystone_rproc_mem_release(void *data) +{ + struct device *dev = data; + + of_reserved_mem_device_release(dev); +} + static int keystone_rproc_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -434,8 +441,14 @@ static int keystone_rproc_probe(struct platform_device *pdev) goto disable_clk; } - if (of_reserved_mem_device_init(dev)) + ret = of_reserved_mem_device_init(dev); + if (ret) { dev_warn(dev, "device does not have specific CMA pool\n"); + } else { + ret = devm_add_action_or_reset(dev, keystone_rproc_mem_release, dev); + if (ret) + return ret; + } /* ensure the DSP is in reset before loading firmware */ ret = reset_control_status(ksproc->reset); @@ -459,7 +472,6 @@ static int keystone_rproc_probe(struct platform_device *pdev) return 0; release_mem: - of_reserved_mem_device_release(dev); gpiod_put(ksproc->kick_gpio); disable_clk: pm_runtime_put_sync(dev); @@ -476,7 +488,6 @@ static void keystone_rproc_remove(struct platform_device *pdev) gpiod_put(ksproc->kick_gpio); pm_runtime_put_sync(&pdev->dev); pm_runtime_disable(&pdev->dev); - of_reserved_mem_device_release(&pdev->dev); } static const struct of_device_id keystone_rproc_of_match[] = { From patchwork Fri Aug 2 18:22:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 13751866 Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D010021C180; Fri, 2 Aug 2024 18:23:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.248 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722623004; cv=none; b=Z59bHSz5UHYJtpTjxk0bm+jXL2q4sQIKdOD74/orl+nOTjJJ5VwkQRbhQQwbysOMoxG9XZr+ZtSkX1wjVHa8TJfIXnC5J//IAmARbLfopBzN9uOMoF+JN8CW7peQKLjd8Byc9qlcSHma1jY9BhSA6T2LPlpmk9/XAgzimAgaxao= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722623004; c=relaxed/simple; bh=AW7+aepCwo2s4GgSk1Ro22T2P245hCm6infgWrT0z2M=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PsjhFOx5pxoLp5OWUhdyc3DtCKsGiFCbAVefpgD2UJdwZw2feAuAtakIT+RA7VyTct4CB42zX7yazAsLFUICioHqnbAx/okAgxlO/QZkop8itK3++3xZzBXmnr4VIBI4ewDa/T0heNwehBr7HxHfXDq6sXKp9ma3tz887ZO3fro= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=rLMW0MvV; arc=none smtp.client-ip=198.47.23.248 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="rLMW0MvV" Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 472IN7Da020284; Fri, 2 Aug 2024 13:23:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1722622987; bh=NI27/FycpGqHlaV5VaK7X2zGEqiGXCBpHNDJ+WdCRXM=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=rLMW0MvVfvZU0CAbkB5wNquQPVFce66I3hnU3sKVDmALYzjjI9bYPtldPAIJMex4U inTfIJ+h3E7eYMFVhEKIWK0RcAqjtlIT7o7L9IsB1nNKyeIk1TG+s4qVBZkBBm2ZFW H5gxWrV8eSb0whaT8/8QL5cZZm0MKiUFbbOtXIhc= Received: from DFLE100.ent.ti.com (dfle100.ent.ti.com [10.64.6.21]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 472IN7fs071391 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 2 Aug 2024 13:23:07 -0500 Received: from DFLE104.ent.ti.com (10.64.6.25) by DFLE100.ent.ti.com (10.64.6.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Fri, 2 Aug 2024 13:23:02 -0500 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Fri, 2 Aug 2024 13:23:02 -0500 Received: from lelvsmtp5.itg.ti.com ([10.249.42.149]) by lelvsmtp6.itg.ti.com (8.15.2/8.15.2) with ESMTP id 472IN0BT039524; Fri, 2 Aug 2024 13:23:01 -0500 From: Andrew Davis To: Hari Nagalla , Bjorn Andersson , Mathieu Poirier CC: , , Andrew Davis Subject: [PATCH 4/7] remoteproc: keystone: Use devm_pm_runtime_enable() helper Date: Fri, 2 Aug 2024 13:22:57 -0500 Message-ID: <20240802182300.244055-4-afd@ti.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240802182300.244055-1-afd@ti.com> References: <20240802182300.244055-1-afd@ti.com> Precedence: bulk X-Mailing-List: linux-remoteproc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Use device life-cycle managed runtime enable function to simplify probe and exit paths. Signed-off-by: Andrew Davis --- drivers/remoteproc/keystone_remoteproc.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/remoteproc/keystone_remoteproc.c b/drivers/remoteproc/keystone_remoteproc.c index 033e573544fef..f457cadc1fae0 100644 --- a/drivers/remoteproc/keystone_remoteproc.c +++ b/drivers/remoteproc/keystone_remoteproc.c @@ -410,12 +410,13 @@ static int keystone_rproc_probe(struct platform_device *pdev) return PTR_ERR(ksproc->reset); /* enable clock for accessing DSP internal memories */ - pm_runtime_enable(dev); + ret = devm_pm_runtime_enable(dev); + if (ret < 0) + return dev_err_probe(dev, ret, "Failed to enable runtime PM\n"); + ret = pm_runtime_resume_and_get(dev); - if (ret < 0) { - dev_err(dev, "failed to enable clock, status = %d\n", ret); - goto disable_rpm; - } + if (ret < 0) + return dev_err_probe(dev, ret, "failed to enable clock\n"); ret = keystone_rproc_of_get_memories(pdev, ksproc); if (ret) @@ -475,8 +476,6 @@ static int keystone_rproc_probe(struct platform_device *pdev) gpiod_put(ksproc->kick_gpio); disable_clk: pm_runtime_put_sync(dev); -disable_rpm: - pm_runtime_disable(dev); return ret; } @@ -487,7 +486,6 @@ static void keystone_rproc_remove(struct platform_device *pdev) rproc_del(ksproc->rproc); gpiod_put(ksproc->kick_gpio); pm_runtime_put_sync(&pdev->dev); - pm_runtime_disable(&pdev->dev); } static const struct of_device_id keystone_rproc_of_match[] = { From patchwork Fri Aug 2 18:22:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 13751860 Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4D06C1AE05A; Fri, 2 Aug 2024 18:23:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.19.142 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722622994; cv=none; b=aTkY/Hcnut8xQ2hbE7zH0x3XwjudhHIKCRPec0LxQi20QDg6tzsaTqtaBWDi0vNCnYmpI68xDc4zqvhCQZQP23IcyqP9Fl1AVmu59MnW/RO6fciLkz8vLoTBZ+ixkR2m16VL1P0Ue9PJTr3/w6iuGJTuTDsc4bMx++BzwmzL0xk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722622994; c=relaxed/simple; bh=rJgAl2O0ZJO8rgCPEVw0NiLl953Q04lQpcEyBNjYPy0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=COcNKIe2dW8ihcbfKrT+fzwMejrYYpqMTEzKHMSdx7nqyai55mCQ0N+YSy6K5B2PDr0ABwQk6xH99cPRT7y20BqtnAV4/znaLoq5A9d4EVaxCbnWQRSHCwhb1ZglpQXZM7scThk6gUc8WhBhMKn/gKCXUwbR3J9nWm7soMSFc9Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=pCuVmrDp; arc=none smtp.client-ip=198.47.19.142 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="pCuVmrDp" Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 472IN3gv091693; Fri, 2 Aug 2024 13:23:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1722622983; bh=D05ogUP7M3NPmfc18cqNc7y1c0EOJJTWkiJt31qgICE=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=pCuVmrDpyhHkx0Csty94/qIB79/4dVAT1wmwas05G02d5Vaipmj9L5OjRxHGfuv5+ SH2MDFLoaQon5z/QqsziFJMCuT1bDILbeLUo3Rfm10rGSmH1sLNssxPTJ/zUkBRAxN gdVhGIjFmmVcDNKEypF63UWRMQ6tLPRfEfLoyLVo= Received: from DLEE100.ent.ti.com (dlee100.ent.ti.com [157.170.170.30]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 472IN3fK071359 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 2 Aug 2024 13:23:03 -0500 Received: from DLEE111.ent.ti.com (157.170.170.22) by DLEE100.ent.ti.com (157.170.170.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Fri, 2 Aug 2024 13:23:02 -0500 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DLEE111.ent.ti.com (157.170.170.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Fri, 2 Aug 2024 13:23:02 -0500 Received: from lelvsmtp5.itg.ti.com ([10.249.42.149]) by lelvsmtp6.itg.ti.com (8.15.2/8.15.2) with ESMTP id 472IN0BU039524; Fri, 2 Aug 2024 13:23:02 -0500 From: Andrew Davis To: Hari Nagalla , Bjorn Andersson , Mathieu Poirier CC: , , Andrew Davis Subject: [PATCH 5/7] remoteproc: keystone: Use devm action to call PM runtime put sync Date: Fri, 2 Aug 2024 13:22:58 -0500 Message-ID: <20240802182300.244055-5-afd@ti.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240802182300.244055-1-afd@ti.com> References: <20240802182300.244055-1-afd@ti.com> Precedence: bulk X-Mailing-List: linux-remoteproc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 This helps prevent mistakes like putting out of order in cleanup functions and forgetting to put sync on error paths. Signed-off-by: Andrew Davis --- drivers/remoteproc/keystone_remoteproc.c | 34 ++++++++++++------------ 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/drivers/remoteproc/keystone_remoteproc.c b/drivers/remoteproc/keystone_remoteproc.c index f457cadc1fae0..e65f99b1bf379 100644 --- a/drivers/remoteproc/keystone_remoteproc.c +++ b/drivers/remoteproc/keystone_remoteproc.c @@ -365,6 +365,13 @@ static void keystone_rproc_mem_release(void *data) of_reserved_mem_device_release(dev); } +static void keystone_rproc_pm_runtime_put(void *data) +{ + struct device *dev = data; + + pm_runtime_put_sync(dev); +} + static int keystone_rproc_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -417,30 +424,26 @@ static int keystone_rproc_probe(struct platform_device *pdev) ret = pm_runtime_resume_and_get(dev); if (ret < 0) return dev_err_probe(dev, ret, "failed to enable clock\n"); + ret = devm_add_action_or_reset(dev, keystone_rproc_pm_runtime_put, dev); + if (ret) + return dev_err_probe(dev, ret, "failed to add disable pm devm action\n"); ret = keystone_rproc_of_get_memories(pdev, ksproc); if (ret) - goto disable_clk; + return ret; ksproc->irq_ring = platform_get_irq_byname(pdev, "vring"); - if (ksproc->irq_ring < 0) { - ret = ksproc->irq_ring; - goto disable_clk; - } + if (ksproc->irq_ring < 0) + return ksproc->irq_ring; ksproc->irq_fault = platform_get_irq_byname(pdev, "exception"); - if (ksproc->irq_fault < 0) { - ret = ksproc->irq_fault; - goto disable_clk; - } + if (ksproc->irq_fault < 0) + return ksproc->irq_fault; ksproc->kick_gpio = gpiod_get(dev, "kick", GPIOD_ASIS); ret = PTR_ERR_OR_ZERO(ksproc->kick_gpio); - if (ret) { - dev_err(dev, "failed to get gpio for virtio kicks, status = %d\n", - ret); - goto disable_clk; - } + if (ret) + return dev_err_probe(dev, ret, "failed to get gpio for virtio kicks\n"); ret = of_reserved_mem_device_init(dev); if (ret) { @@ -474,8 +477,6 @@ static int keystone_rproc_probe(struct platform_device *pdev) release_mem: gpiod_put(ksproc->kick_gpio); -disable_clk: - pm_runtime_put_sync(dev); return ret; } @@ -485,7 +486,6 @@ static void keystone_rproc_remove(struct platform_device *pdev) rproc_del(ksproc->rproc); gpiod_put(ksproc->kick_gpio); - pm_runtime_put_sync(&pdev->dev); } static const struct of_device_id keystone_rproc_of_match[] = { From patchwork Fri Aug 2 18:22:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 13751863 Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E4E21A83D0; Fri, 2 Aug 2024 18:23:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.19.141 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722622999; cv=none; b=HIdJg4LZnV67ZrtCHqFa7p8r4WIgn5xVN/VCTcLEj35/qKfiKHDtzIViPk+P5YFe9X0Bbx6Q1ucI4KiZmHVFnqT5m0JfGg4p0AOQywoPcTk3AvcKeYsUpiezABkMKBt5HqRalN1gWkW7oLD/5EFhpT7DurTujB9efHdvvtffEsg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722622999; c=relaxed/simple; bh=YTijXSwbtkDt+G+LCvECK+11VvEPBRmo9gUYwYTi6xQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=R11+QSC/pPsxP/8owad7Ch+w6kWLtxuPm6uvq8WQm/1o7AoMvITnnctlAaQDFu2vUB2B+y4IcJqK6tmjftfNcmlWfwe1B8qm182p9aNATBiSzAOa1d5XtxWBDMcFbkVPDMqf4VhW1wza1IdRoRYvUHOEn++S+olEHZf/+gZp9TM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=aPeBVC8J; arc=none smtp.client-ip=198.47.19.141 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="aPeBVC8J" Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 472IN3Sh069886; Fri, 2 Aug 2024 13:23:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1722622983; bh=J0m4m+3HttioTdWTTPB2v877twY5lb3S3IK/+3qAB9I=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=aPeBVC8J1vQ1zB9oeWgGwSxspR9uWUAMlL1e8fKtNwyrQB9oKnBEiQ3GNPjOJFWKU fHBEkel+tGuBb01wDZSzpw0f0Man8pOlZUKVj9KEPx67P1H2wT1wyNWUxCPTasiGII HzHkFw+TKmzS1x0rRXC/FyvT8qFhA+TfeJgUSCUI= Received: from DFLE106.ent.ti.com (dfle106.ent.ti.com [10.64.6.27]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 472IN3jv079454 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 2 Aug 2024 13:23:03 -0500 Received: from DFLE114.ent.ti.com (10.64.6.35) by DFLE106.ent.ti.com (10.64.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Fri, 2 Aug 2024 13:23:02 -0500 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Fri, 2 Aug 2024 13:23:02 -0500 Received: from lelvsmtp5.itg.ti.com ([10.249.42.149]) by lelvsmtp6.itg.ti.com (8.15.2/8.15.2) with ESMTP id 472IN0BV039524; Fri, 2 Aug 2024 13:23:02 -0500 From: Andrew Davis To: Hari Nagalla , Bjorn Andersson , Mathieu Poirier CC: , , Andrew Davis Subject: [PATCH 6/7] remoteproc: keystone: Use devm_gpiod_get() helper Date: Fri, 2 Aug 2024 13:22:59 -0500 Message-ID: <20240802182300.244055-6-afd@ti.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240802182300.244055-1-afd@ti.com> References: <20240802182300.244055-1-afd@ti.com> Precedence: bulk X-Mailing-List: linux-remoteproc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Use device life-cycle managed GPIO get function to simplify probe and exit paths. Signed-off-by: Andrew Davis --- drivers/remoteproc/keystone_remoteproc.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/drivers/remoteproc/keystone_remoteproc.c b/drivers/remoteproc/keystone_remoteproc.c index e65f99b1bf379..da5d5969829fb 100644 --- a/drivers/remoteproc/keystone_remoteproc.c +++ b/drivers/remoteproc/keystone_remoteproc.c @@ -440,7 +440,7 @@ static int keystone_rproc_probe(struct platform_device *pdev) if (ksproc->irq_fault < 0) return ksproc->irq_fault; - ksproc->kick_gpio = gpiod_get(dev, "kick", GPIOD_ASIS); + ksproc->kick_gpio = devm_gpiod_get(dev, "kick", GPIOD_ASIS); ret = PTR_ERR_OR_ZERO(ksproc->kick_gpio); if (ret) return dev_err_probe(dev, ret, "failed to get gpio for virtio kicks\n"); @@ -457,27 +457,19 @@ static int keystone_rproc_probe(struct platform_device *pdev) /* ensure the DSP is in reset before loading firmware */ ret = reset_control_status(ksproc->reset); if (ret < 0) { - dev_err(dev, "failed to get reset status, status = %d\n", ret); - goto release_mem; + return dev_err_probe(dev, ret, "failed to get reset status\n"); } else if (ret == 0) { WARN(1, "device is not in reset\n"); keystone_rproc_dsp_reset(ksproc); } ret = rproc_add(rproc); - if (ret) { - dev_err(dev, "failed to add register device with remoteproc core, status = %d\n", - ret); - goto release_mem; - } + if (ret) + return dev_err_probe(dev, ret, "failed to register device with remoteproc core\n"); platform_set_drvdata(pdev, ksproc); return 0; - -release_mem: - gpiod_put(ksproc->kick_gpio); - return ret; } static void keystone_rproc_remove(struct platform_device *pdev) @@ -485,7 +477,6 @@ static void keystone_rproc_remove(struct platform_device *pdev) struct keystone_rproc *ksproc = platform_get_drvdata(pdev); rproc_del(ksproc->rproc); - gpiod_put(ksproc->kick_gpio); } static const struct of_device_id keystone_rproc_of_match[] = { From patchwork Fri Aug 2 18:23:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 13751862 Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A1297165F0A; Fri, 2 Aug 2024 18:23:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.19.141 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722622998; cv=none; b=liMr1sTKJwWxMV4XiIqSPufaHzQxuwxqvjiBlZFeNrWR2EtGPLJLO+uhmJ2zcM/SWlPpUsp1of+q0iOmlWbp+l4rekeo72I9ehH3YfPxlQpwWpW3dMC4jYVpHuJWXS3mqRC0G3jTdvh4kr/z+6ECKjMnUcgIVY2Xn2G4erb10f4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722622998; c=relaxed/simple; bh=BZQIjqi3RVmv20lIjZed/236F9Ix29Tk7k2nJ/s+hmo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KZUnOKMxLleURSjWf9i8CXILv58kqxOij4ab/RuWCrfBJ2I8SeGaXTp5CNLaIUgzY45snJJShgu8uPSH0ng3/b59wo2WKd9thaZQVMxfeiLtBvokuvh02Ck2Hgk/cwcH/mDkLsXV1/CWsukUAWfgLItPzGnJiam0SP3alq2Gcmo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=xrqqjxoQ; arc=none smtp.client-ip=198.47.19.141 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="xrqqjxoQ" Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 472IN7Ol069897; Fri, 2 Aug 2024 13:23:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1722622987; bh=0mbRMD8jBzGMNnJ6EKpzKJECBjbh92PM3dytT8hEJS8=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=xrqqjxoQVGk1fzjVHOqf/R0YppZJmEh6FkyfRYaooZnie+PQOWOjpg649DizSvP17 5oUP5DDFdlAIOnFj1dTzTuVdzbOfW1Cy0VdxuB8Xc4diXne++XhM/kk+aIqGX6Sb/G L74RmoDzwgH4uL8dncOVJKl6MllfV5zPUMDxbHSI= Received: from DFLE100.ent.ti.com (dfle100.ent.ti.com [10.64.6.21]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 472IN7fr071391 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 2 Aug 2024 13:23:07 -0500 Received: from DFLE108.ent.ti.com (10.64.6.29) by DFLE100.ent.ti.com (10.64.6.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Fri, 2 Aug 2024 13:23:03 -0500 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DFLE108.ent.ti.com (10.64.6.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Fri, 2 Aug 2024 13:23:03 -0500 Received: from lelvsmtp5.itg.ti.com ([10.249.42.149]) by lelvsmtp6.itg.ti.com (8.15.2/8.15.2) with ESMTP id 472IN0BW039524; Fri, 2 Aug 2024 13:23:02 -0500 From: Andrew Davis To: Hari Nagalla , Bjorn Andersson , Mathieu Poirier CC: , , Andrew Davis Subject: [PATCH 7/7] remoteproc: keystone: Use devm_rproc_add() helper Date: Fri, 2 Aug 2024 13:23:00 -0500 Message-ID: <20240802182300.244055-7-afd@ti.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240802182300.244055-1-afd@ti.com> References: <20240802182300.244055-1-afd@ti.com> Precedence: bulk X-Mailing-List: linux-remoteproc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Use the device lifecycle managed add function. This helps prevent mistakes like deleting out of order in cleanup functions and forgetting to delete on error paths. Signed-off-by: Andrew Davis --- drivers/remoteproc/keystone_remoteproc.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/remoteproc/keystone_remoteproc.c b/drivers/remoteproc/keystone_remoteproc.c index da5d5969829fb..27ebe6661b0b7 100644 --- a/drivers/remoteproc/keystone_remoteproc.c +++ b/drivers/remoteproc/keystone_remoteproc.c @@ -463,22 +463,13 @@ static int keystone_rproc_probe(struct platform_device *pdev) keystone_rproc_dsp_reset(ksproc); } - ret = rproc_add(rproc); + ret = devm_rproc_add(dev, rproc); if (ret) return dev_err_probe(dev, ret, "failed to register device with remoteproc core\n"); - platform_set_drvdata(pdev, ksproc); - return 0; } -static void keystone_rproc_remove(struct platform_device *pdev) -{ - struct keystone_rproc *ksproc = platform_get_drvdata(pdev); - - rproc_del(ksproc->rproc); -} - static const struct of_device_id keystone_rproc_of_match[] = { { .compatible = "ti,k2hk-dsp", }, { .compatible = "ti,k2l-dsp", }, @@ -490,7 +481,6 @@ MODULE_DEVICE_TABLE(of, keystone_rproc_of_match); static struct platform_driver keystone_rproc_driver = { .probe = keystone_rproc_probe, - .remove_new = keystone_rproc_remove, .driver = { .name = "keystone-rproc", .of_match_table = keystone_rproc_of_match,