From patchwork Sun Nov 15 19:51:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moritz Fischer X-Patchwork-Id: 11906755 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DEE63139F for ; Sun, 15 Nov 2020 19:51:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CA2C82231B for ; Sun, 15 Nov 2020 19:51:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727521AbgKOTvc (ORCPT ); Sun, 15 Nov 2020 14:51:32 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:37140 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727263AbgKOTvb (ORCPT ); Sun, 15 Nov 2020 14:51:31 -0500 Received: by mail-pf1-f195.google.com with SMTP id c66so11389753pfa.4; Sun, 15 Nov 2020 11:51:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kaCMoVF5ntXg+etJc321w7tzX64fi2nIl8DoCz0hp/Q=; b=mo09ZekgCgl+8aLBDcUCrakmYOJY2arIW7/N9rRpNjid6WG0ghJtQp4C6GdBPbIQpy CHeXiDJSow/NfW8Vz1GBsb118DwewTXasPSc1KsokTdcw7dkgiVi+CG+7mzZZTo5ivNW 01Dg7BFAzylgt7EbaaZi5ik0ukCkUDrMc7jVqarzMj3/92/X99cXxG/XZ0rkPW0wJewD dJriEqp7xEWYe3ZjMz2NUtj/PFs98hFXHNZDfPCpeMm9Ux5dshkKACaDKkaamh8L4mbn 30uAzoGRUpsIeLhGwjmTAQCdF006ttIZBUkuRMEu7HEeFg0BbXoG2SksCmAIZHbtMNKp dwYw== X-Gm-Message-State: AOAM5334lBqmIhucUkEqEiqBbUezPqeW3AbzDs+UKI3wQWDyhL3uZfY3 pkFWNEP+UzDbcwyuHPdnTy4= X-Google-Smtp-Source: ABdhPJy/FUDNJ4m30AJjEmUCghd2AP7bGMFVjAaQF0O8Gz9VlDZBUJTQHadmX6JosxD2JxXghbHoIA== X-Received: by 2002:a17:90a:db89:: with SMTP id h9mr10616467pjv.34.1605469891107; Sun, 15 Nov 2020 11:51:31 -0800 (PST) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id t74sm15901133pfc.47.2020.11.15.11.51.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Nov 2020 11:51:30 -0800 (PST) From: Moritz Fischer To: gregkh@linuxfoundation.org Cc: linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org, trix@redhat.com, Moritz Fischer Subject: [RESEND PATCH 01/10] fpga: fpga-mgr: Add devm_fpga_mgr_register() API Date: Sun, 15 Nov 2020 11:51:18 -0800 Message-Id: <20201115195127.284487-2-mdf@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201115195127.284487-1-mdf@kernel.org> References: <20201115195127.284487-1-mdf@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fpga@vger.kernel.org Add a devm_fpga_mgr_register() API that can be used to register a FPGA Manager that was created using devm_fpga_mgr_create(). Introduce a struct fpga_mgr_devres that makes the devres allocation a little bit more readable and gets reused for devm_fpga_mgr_create() devm_fpga_mgr_register(). Reviewed-by: Tom Rix Signed-off-by: Moritz Fischer --- drivers/fpga/fpga-mgr.c | 81 +++++++++++++++++++++++++++++------ include/linux/fpga/fpga-mgr.h | 2 + 2 files changed, 71 insertions(+), 12 deletions(-) diff --git a/drivers/fpga/fpga-mgr.c b/drivers/fpga/fpga-mgr.c index f38bab01432e..b85bc47c91a9 100644 --- a/drivers/fpga/fpga-mgr.c +++ b/drivers/fpga/fpga-mgr.c @@ -21,6 +21,10 @@ static DEFINE_IDA(fpga_mgr_ida); static struct class *fpga_mgr_class; +struct fpga_mgr_devres { + struct fpga_manager *mgr; +}; + /** * fpga_image_info_alloc - Allocate a FPGA image info struct * @dev: owning device @@ -625,9 +629,9 @@ EXPORT_SYMBOL_GPL(fpga_mgr_free); static void devm_fpga_mgr_release(struct device *dev, void *res) { - struct fpga_manager *mgr = *(struct fpga_manager **)res; + struct fpga_mgr_devres *dr = res; - fpga_mgr_free(mgr); + fpga_mgr_free(dr->mgr); } /** @@ -651,21 +655,21 @@ struct fpga_manager *devm_fpga_mgr_create(struct device *dev, const char *name, const struct fpga_manager_ops *mops, void *priv) { - struct fpga_manager **ptr, *mgr; + struct fpga_mgr_devres *dr; - ptr = devres_alloc(devm_fpga_mgr_release, sizeof(*ptr), GFP_KERNEL); - if (!ptr) + dr = devres_alloc(devm_fpga_mgr_release, sizeof(*dr), GFP_KERNEL); + if (!dr) return NULL; - mgr = fpga_mgr_create(dev, name, mops, priv); - if (!mgr) { - devres_free(ptr); - } else { - *ptr = mgr; - devres_add(dev, ptr); + dr->mgr = fpga_mgr_create(dev, name, mops, priv); + if (!dr->mgr) { + devres_free(dr); + return NULL; } - return mgr; + devres_add(dev, dr); + + return dr->mgr; } EXPORT_SYMBOL_GPL(devm_fpga_mgr_create); @@ -722,6 +726,59 @@ void fpga_mgr_unregister(struct fpga_manager *mgr) } EXPORT_SYMBOL_GPL(fpga_mgr_unregister); +static int fpga_mgr_devres_match(struct device *dev, void *res, + void *match_data) +{ + struct fpga_mgr_devres *dr = res; + + return match_data == dr->mgr; +} + +static void devm_fpga_mgr_unregister(struct device *dev, void *res) +{ + struct fpga_mgr_devres *dr = res; + + fpga_mgr_unregister(dr->mgr); +} + +/** + * devm_fpga_mgr_register - resource managed variant of fpga_mgr_register() + * @dev: managing device for this FPGA manager + * @mgr: fpga manager struct + * + * This is the devres variant of fpga_mgr_register() for which the unregister + * function will be called automatically when the managing device is detached. + */ +int devm_fpga_mgr_register(struct device *dev, struct fpga_manager *mgr) +{ + struct fpga_mgr_devres *dr; + int ret; + + /* + * Make sure that the struct fpga_manager * that is passed in is + * managed itself. + */ + if (WARN_ON(!devres_find(dev, devm_fpga_mgr_release, + fpga_mgr_devres_match, mgr))) + return -EINVAL; + + dr = devres_alloc(devm_fpga_mgr_unregister, sizeof(*dr), GFP_KERNEL); + if (!dr) + return -ENOMEM; + + ret = fpga_mgr_register(mgr); + if (ret) { + devres_free(dr); + return ret; + } + + dr->mgr = mgr; + devres_add(dev, dr); + + return 0; +} +EXPORT_SYMBOL_GPL(devm_fpga_mgr_register); + static void fpga_mgr_dev_release(struct device *dev) { } diff --git a/include/linux/fpga/fpga-mgr.h b/include/linux/fpga/fpga-mgr.h index e8ca62b2cb5b..2bc3030a69e5 100644 --- a/include/linux/fpga/fpga-mgr.h +++ b/include/linux/fpga/fpga-mgr.h @@ -198,6 +198,8 @@ void fpga_mgr_free(struct fpga_manager *mgr); int fpga_mgr_register(struct fpga_manager *mgr); void fpga_mgr_unregister(struct fpga_manager *mgr); +int devm_fpga_mgr_register(struct device *dev, struct fpga_manager *mgr); + struct fpga_manager *devm_fpga_mgr_create(struct device *dev, const char *name, const struct fpga_manager_ops *mops, void *priv); From patchwork Sun Nov 15 19:51:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moritz Fischer X-Patchwork-Id: 11906759 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 448B8139F for ; Sun, 15 Nov 2020 19:52:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3594822384 for ; Sun, 15 Nov 2020 19:52:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727708AbgKOTvd (ORCPT ); Sun, 15 Nov 2020 14:51:33 -0500 Received: from mail-pg1-f171.google.com ([209.85.215.171]:45822 "EHLO mail-pg1-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727698AbgKOTvd (ORCPT ); Sun, 15 Nov 2020 14:51:33 -0500 Received: by mail-pg1-f171.google.com with SMTP id 62so10779645pgg.12; Sun, 15 Nov 2020 11:51:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gv5YgYJ8YTJ3R7OvjrDzA+z8efZW97/lIglyWelRkeo=; b=HXg6CP41VbdXOZikXsGo23uE2A6E4KS9bwxFQbH6gdoLMQ9EwnYJda8/zY3go9Ufbh H00y69pmkAvCfdLrgJKBIUTc5m2FcbPPJe9b16sdHCPc+n+EsaWCuHXxUd8LyOWRzdSo MkH75JJYm0MZi1Q+wBBENlGuzGKR8laIqSOTbdq5BDnWZUywr2r0YnMreyPM4U4AfWzq NeY47pZN7NadEKERsqmFEtzha/HV2GQGMoCdGLiZgupo/mCJqtriX9tmYTmbx9uK9FW3 TWaKAOL8mkhvxNTK8SN7GIKQ77dryBa/r0Czg7m1tNHL91CW3oMYujIH0AXSERvTL8H2 MITQ== X-Gm-Message-State: AOAM531MJSAHLku5g6VvbgbrYWg3fUgq45VMdVShSNx+DtXqrXwnXJQS gOikpO6AzYh5b2oatOsAFKk= X-Google-Smtp-Source: ABdhPJzreaOwndoKWDr4DBWNwpE0W5ACzhsDXSUcuY6Uv/sRsH3srffclGtCywFsSBPBJOlfFxOxjg== X-Received: by 2002:a62:3850:0:b029:18b:70ea:1537 with SMTP id f77-20020a6238500000b029018b70ea1537mr11149281pfa.68.1605469892467; Sun, 15 Nov 2020 11:51:32 -0800 (PST) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id t12sm16213341pfq.79.2020.11.15.11.51.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Nov 2020 11:51:31 -0800 (PST) From: Moritz Fischer To: gregkh@linuxfoundation.org Cc: linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org, trix@redhat.com, Moritz Fischer Subject: [RESEND PATCH 02/10] fpga: fpga-mgr: altera-ps-spi: Simplify registration Date: Sun, 15 Nov 2020 11:51:19 -0800 Message-Id: <20201115195127.284487-3-mdf@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201115195127.284487-1-mdf@kernel.org> References: <20201115195127.284487-1-mdf@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fpga@vger.kernel.org Simplify registration by using new devm_fpga_mgr_register() API. Reviewed-by: Tom Rix Signed-off-by: Moritz Fischer --- drivers/fpga/altera-ps-spi.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/fpga/altera-ps-spi.c b/drivers/fpga/altera-ps-spi.c index 0221dee8dd4c..23bfd4d1ad0f 100644 --- a/drivers/fpga/altera-ps-spi.c +++ b/drivers/fpga/altera-ps-spi.c @@ -307,18 +307,7 @@ static int altera_ps_probe(struct spi_device *spi) if (!mgr) return -ENOMEM; - spi_set_drvdata(spi, mgr); - - return fpga_mgr_register(mgr); -} - -static int altera_ps_remove(struct spi_device *spi) -{ - struct fpga_manager *mgr = spi_get_drvdata(spi); - - fpga_mgr_unregister(mgr); - - return 0; + return devm_fpga_mgr_register(&spi->dev, mgr); } static const struct spi_device_id altera_ps_spi_ids[] = { @@ -337,7 +326,6 @@ static struct spi_driver altera_ps_driver = { }, .id_table = altera_ps_spi_ids, .probe = altera_ps_probe, - .remove = altera_ps_remove, }; module_spi_driver(altera_ps_driver) From patchwork Sun Nov 15 19:51:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moritz Fischer X-Patchwork-Id: 11906777 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 54AA2697 for ; Sun, 15 Nov 2020 20:03:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3A40B22409 for ; Sun, 15 Nov 2020 20:03:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727741AbgKOTvg (ORCPT ); Sun, 15 Nov 2020 14:51:36 -0500 Received: from mail-pg1-f172.google.com ([209.85.215.172]:40871 "EHLO mail-pg1-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727739AbgKOTvf (ORCPT ); Sun, 15 Nov 2020 14:51:35 -0500 Received: by mail-pg1-f172.google.com with SMTP id h16so6726749pgb.7; Sun, 15 Nov 2020 11:51:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XBwW1+6BENeZRQOZlmvQP7cIaRFiF4Q75GwsKxUaHjk=; b=F4gTXPCEOo3a10GTNBKar9+TUIwuWJNymQ+WZHo4PRRs/fCQlRXOa1W99aJ3iETU2Z FSrQtREW7ibnrFPfwXC4iaJswEhnL7e6VA4elHUJe+TMp4mraGuV40504SeFMOibXCRd +k6nY70GL7to7CfSdcp12LH02a5TV56/Db1U5EJ1y9f/7uiDAmfgOgh3SqLE7v0LsSZj gJ46j2jjQ2ZAe2h+LAzG2xoBmfJRWNX+O10fCNtJ3+ho6dhNxs8DjCjGmxRcuvkOU0+7 uy8k1Vdnp5odanmOOZSzXBOcLlqq0fxNX732m2WJuWr6pOj7i9iyb+IpQB9WeTc4xiQm 42+A== X-Gm-Message-State: AOAM532jnMVYbMVkeA23Wo+ndriCY/oEWcf07PuZbmT7txQL9rCaCwG/ mvYFUZ3FkiMwv+bDdjnwYanYA+mReg8= X-Google-Smtp-Source: ABdhPJxqle0zjwf6uUZaQK/1eAp+Yk2Z9AWoN5EnVknYvpDGFO7Uc9kpM3dleB7QpygDZSTKxoDKgQ== X-Received: by 2002:a63:887:: with SMTP id 129mr10015088pgi.81.1605469893832; Sun, 15 Nov 2020 11:51:33 -0800 (PST) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id o16sm14335839pgn.66.2020.11.15.11.51.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Nov 2020 11:51:33 -0800 (PST) From: Moritz Fischer To: gregkh@linuxfoundation.org Cc: linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org, trix@redhat.com, Moritz Fischer Subject: [RESEND PATCH 03/10] fpga: fpga-mgr: dfl-fme-mgr: Simplify registration Date: Sun, 15 Nov 2020 11:51:20 -0800 Message-Id: <20201115195127.284487-4-mdf@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201115195127.284487-1-mdf@kernel.org> References: <20201115195127.284487-1-mdf@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fpga@vger.kernel.org Simplify registration using new devm_fpga_mgr_register() API. Reviewed-by: Tom Rix Signed-off-by: Moritz Fischer --- drivers/fpga/dfl-fme-mgr.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/fpga/dfl-fme-mgr.c b/drivers/fpga/dfl-fme-mgr.c index b3f7eee3c93f..d5861d13b306 100644 --- a/drivers/fpga/dfl-fme-mgr.c +++ b/drivers/fpga/dfl-fme-mgr.c @@ -314,18 +314,8 @@ static int fme_mgr_probe(struct platform_device *pdev) return -ENOMEM; mgr->compat_id = compat_id; - platform_set_drvdata(pdev, mgr); - return fpga_mgr_register(mgr); -} - -static int fme_mgr_remove(struct platform_device *pdev) -{ - struct fpga_manager *mgr = platform_get_drvdata(pdev); - - fpga_mgr_unregister(mgr); - - return 0; + return devm_fpga_mgr_register(dev, mgr); } static struct platform_driver fme_mgr_driver = { @@ -333,7 +323,6 @@ static struct platform_driver fme_mgr_driver = { .name = DFL_FPGA_FME_MGR, }, .probe = fme_mgr_probe, - .remove = fme_mgr_remove, }; module_platform_driver(fme_mgr_driver); From patchwork Sun Nov 15 19:51:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moritz Fischer X-Patchwork-Id: 11906773 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D82D1139F for ; Sun, 15 Nov 2020 19:54:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C8EA722384 for ; Sun, 15 Nov 2020 19:54:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727770AbgKOTvg (ORCPT ); Sun, 15 Nov 2020 14:51:36 -0500 Received: from mail-pl1-f174.google.com ([209.85.214.174]:41409 "EHLO mail-pl1-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727698AbgKOTvf (ORCPT ); Sun, 15 Nov 2020 14:51:35 -0500 Received: by mail-pl1-f174.google.com with SMTP id 5so263066plj.8; Sun, 15 Nov 2020 11:51:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7WDy5qn9Dd1AOqQC/fHx0aM5r8uAiocYkoWjGzpwBnU=; b=tQBUpmNqvMrTBVo6lk0TQe02/w0gD4gTgcz+mXTnxa01K49602ECVU919Vs0q6JwFK KJsZanBZBtgqvlkXc+zGQNJw9B0w2YVlkqbBN/4FnfkENwsqaf6OO2fV9UWjK95pVdHx uM9N+IzTeuZrgP9cN2Cg118qXefThOOSf8pT4og42rVsHc0hfqUdGzFqKRWkOs9Qj3oU 1lCas+D+nJjr3DOLcLEuqxtfB+BB9cQ0ZL5PGUUUmyppt9aORIBt2duGPO/Dfq6CqF8c I8lHIeLhgykJ+DSv9l1xtuINBMargppJqsBDZNbcqbnQYw1h+lGelf37OyZ7YJZo3N5z S9iA== X-Gm-Message-State: AOAM532jxIObEL0CjW2lXFCozT5Fl9+nlnk9dAVEqsxZswsZycgDYCr7 1WKX3M9k3DpuQqI8KaRLHvk= X-Google-Smtp-Source: ABdhPJzUG79CU/5ncdOviY0t2iNblNcM60ZxI8b0FHt4iDbjvUt24w2inQziUUWNWuNWQGQFexFWkg== X-Received: by 2002:a17:902:8f88:b029:d6:d62c:e437 with SMTP id z8-20020a1709028f88b02900d6d62ce437mr10148743plo.73.1605469895187; Sun, 15 Nov 2020 11:51:35 -0800 (PST) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id q15sm14245092pgk.93.2020.11.15.11.51.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Nov 2020 11:51:34 -0800 (PST) From: Moritz Fischer To: gregkh@linuxfoundation.org Cc: linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org, trix@redhat.com, Moritz Fischer Subject: [RESEND PATCH 04/10] fpga: fpga-mgr: ice40-spi: Simplify registration Date: Sun, 15 Nov 2020 11:51:21 -0800 Message-Id: <20201115195127.284487-5-mdf@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201115195127.284487-1-mdf@kernel.org> References: <20201115195127.284487-1-mdf@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fpga@vger.kernel.org Simplify registration using new devm_fpga_mgr_register() API. Reviewed-by: Tom Rix Signed-off-by: Moritz Fischer --- drivers/fpga/ice40-spi.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/fpga/ice40-spi.c b/drivers/fpga/ice40-spi.c index 8d689fea0dab..69dec5af23c3 100644 --- a/drivers/fpga/ice40-spi.c +++ b/drivers/fpga/ice40-spi.c @@ -183,18 +183,7 @@ static int ice40_fpga_probe(struct spi_device *spi) if (!mgr) return -ENOMEM; - spi_set_drvdata(spi, mgr); - - return fpga_mgr_register(mgr); -} - -static int ice40_fpga_remove(struct spi_device *spi) -{ - struct fpga_manager *mgr = spi_get_drvdata(spi); - - fpga_mgr_unregister(mgr); - - return 0; + return devm_fpga_mgr_register(dev, mgr); } static const struct of_device_id ice40_fpga_of_match[] = { @@ -205,7 +194,6 @@ MODULE_DEVICE_TABLE(of, ice40_fpga_of_match); static struct spi_driver ice40_fpga_driver = { .probe = ice40_fpga_probe, - .remove = ice40_fpga_remove, .driver = { .name = "ice40spi", .of_match_table = of_match_ptr(ice40_fpga_of_match), From patchwork Sun Nov 15 19:51:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moritz Fischer X-Patchwork-Id: 11906771 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 85DB5697 for ; Sun, 15 Nov 2020 19:54:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 778C322384 for ; Sun, 15 Nov 2020 19:54:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727857AbgKOTvj (ORCPT ); Sun, 15 Nov 2020 14:51:39 -0500 Received: from mail-pf1-f180.google.com ([209.85.210.180]:40558 "EHLO mail-pf1-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727698AbgKOTvi (ORCPT ); Sun, 15 Nov 2020 14:51:38 -0500 Received: by mail-pf1-f180.google.com with SMTP id w14so11365829pfd.7; Sun, 15 Nov 2020 11:51:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kBr5nDKX9MwkDZ7ftTeRFUSoljDD0EUdqGjYF8U//7Q=; b=qvitEwfPN0aBQjHXJr8UGrfbr4JCzRI5OfYWWdeTqbgSD0iz/OcDpDHfBa7qvQYmP0 TFDeV7BQ0W3QEEkhvsCsMQ4FgJBFInJG+ZRQlck9JQ6z/hHSgY6hVKe72cEGmX9ccZn3 r9fnzqEi5p/1tnSzpIF3+GFKlohZGh+YHDcYgR0ZfqeZgRAOAWsq1JZi6x+RSsQgCWQB oitFcXIRe90td2X8Al26BRztbhKQwYhrtV3S9KSPylk8mXTJboM3lzAjQvDMGEau2fY3 B8E4J0Nlv9GDGLvkTCoCTS7Zd3C+ijFVXAediNVWQMgZEeUBDeIZLJtbUwbG+pEI6evk zn/Q== X-Gm-Message-State: AOAM5306pTzlZ8fgIkNY63zlq59j/90hyQFW0cONRwH7s7AS8eVMO/F0 44YR8xl8ZarAHPeJEO25aes= X-Google-Smtp-Source: ABdhPJz8HHmaGVJier6SJQHg4EBKzcJAB6+xSlrpxWJMz852ieiHm+RUdpgqh9/v4AlD+rZkvqpufQ== X-Received: by 2002:aa7:91cf:0:b029:18a:9972:1aa9 with SMTP id z15-20020aa791cf0000b029018a99721aa9mr11151915pfa.46.1605469896597; Sun, 15 Nov 2020 11:51:36 -0800 (PST) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id a18sm9182468pfa.151.2020.11.15.11.51.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Nov 2020 11:51:36 -0800 (PST) From: Moritz Fischer To: gregkh@linuxfoundation.org Cc: linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org, trix@redhat.com, Moritz Fischer Subject: [RESEND PATCH 05/10] fpga: fpga-mgr: machxo2-spi: Simplify registration Date: Sun, 15 Nov 2020 11:51:22 -0800 Message-Id: <20201115195127.284487-6-mdf@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201115195127.284487-1-mdf@kernel.org> References: <20201115195127.284487-1-mdf@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fpga@vger.kernel.org Simplify registration using new devm_fpga_mgr_register() API. Reviewed-by: Tom Rix Signed-off-by: Moritz Fischer --- drivers/fpga/machxo2-spi.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/fpga/machxo2-spi.c b/drivers/fpga/machxo2-spi.c index b316369156fe..114a64d2b7a4 100644 --- a/drivers/fpga/machxo2-spi.c +++ b/drivers/fpga/machxo2-spi.c @@ -371,18 +371,7 @@ static int machxo2_spi_probe(struct spi_device *spi) if (!mgr) return -ENOMEM; - spi_set_drvdata(spi, mgr); - - return fpga_mgr_register(mgr); -} - -static int machxo2_spi_remove(struct spi_device *spi) -{ - struct fpga_manager *mgr = spi_get_drvdata(spi); - - fpga_mgr_unregister(mgr); - - return 0; + return devm_fpga_mgr_register(dev, mgr); } static const struct of_device_id of_match[] = { @@ -403,7 +392,6 @@ static struct spi_driver machxo2_spi_driver = { .of_match_table = of_match_ptr(of_match), }, .probe = machxo2_spi_probe, - .remove = machxo2_spi_remove, .id_table = lattice_ids, }; From patchwork Sun Nov 15 19:51:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moritz Fischer X-Patchwork-Id: 11906761 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 799B0697 for ; Sun, 15 Nov 2020 19:52:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6B58422384 for ; Sun, 15 Nov 2020 19:52:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727698AbgKOTvk (ORCPT ); Sun, 15 Nov 2020 14:51:40 -0500 Received: from mail-pf1-f181.google.com ([209.85.210.181]:41410 "EHLO mail-pf1-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727862AbgKOTvj (ORCPT ); Sun, 15 Nov 2020 14:51:39 -0500 Received: by mail-pf1-f181.google.com with SMTP id c20so11367263pfr.8; Sun, 15 Nov 2020 11:51:38 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3IkrjI+jYJKCZGOoumt4rFok/JaaTpF6hO9yu3jQfDM=; b=JAAeviqGkrP+BlYPJsZ48lyrBsJMbQQRQ6HB1zE75assLsN+wBNisq+/Fq5xFx0krf 9Y4xNHKXqHdRDWHR1HGGNxQu8FFRE9NWQFFSGwDLPyFY0oGntCL2BfqY9YaAJ/yHm5Sj X9deV7JIz5BU9KhlalZv/Cb2//0fI3r5C12DQ2rv8Ax5FKc+L3TkLFtOmFTTES1QOckr 4Y0vqsvTS2zlp4DhlbWuqlgzhEQqFL8VKzMLIR7+JnU8JqSrw6DBw7iwfgC1CP3Da86I xcg4fbvgHkbr+AwBNvPc35su/2b/HrgPR8rb/GqSE12ISMESXYbpCrFL6AOkoH6XqnBL q4sQ== X-Gm-Message-State: AOAM531Ot5RHBF7/cZi7I8XsALeqEsnrir4csUyVQFzsMwwc+cC9+/Cp XjxhxuA0/KOp2OXhS1o/N/YH0IbFi1U= X-Google-Smtp-Source: ABdhPJxSMIYuFjiey1OxrsgqasSWiR7kWdX0rlWcsnHPkBI100KrXF8t52gbx1Y1FlV88lCKuO9Gqw== X-Received: by 2002:a17:90b:316:: with SMTP id ay22mr12611069pjb.8.1605469897899; Sun, 15 Nov 2020 11:51:37 -0800 (PST) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id t32sm15225015pgl.0.2020.11.15.11.51.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Nov 2020 11:51:37 -0800 (PST) From: Moritz Fischer To: gregkh@linuxfoundation.org Cc: linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org, trix@redhat.com, Moritz Fischer Subject: [RESEND PATCH 06/10] fpga: fpga-mgr: socfpga: Simplify registration Date: Sun, 15 Nov 2020 11:51:23 -0800 Message-Id: <20201115195127.284487-7-mdf@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201115195127.284487-1-mdf@kernel.org> References: <20201115195127.284487-1-mdf@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fpga@vger.kernel.org Simplify registration using new devm_fpga_mgr_register() API. Reviewed-by: Tom Rix Signed-off-by: Moritz Fischer --- drivers/fpga/socfpga.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/fpga/socfpga.c b/drivers/fpga/socfpga.c index 4a8a2fcd4e6c..1f467173fc1f 100644 --- a/drivers/fpga/socfpga.c +++ b/drivers/fpga/socfpga.c @@ -576,18 +576,7 @@ static int socfpga_fpga_probe(struct platform_device *pdev) if (!mgr) return -ENOMEM; - platform_set_drvdata(pdev, mgr); - - return fpga_mgr_register(mgr); -} - -static int socfpga_fpga_remove(struct platform_device *pdev) -{ - struct fpga_manager *mgr = platform_get_drvdata(pdev); - - fpga_mgr_unregister(mgr); - - return 0; + return devm_fpga_mgr_register(dev, mgr); } #ifdef CONFIG_OF @@ -601,7 +590,6 @@ MODULE_DEVICE_TABLE(of, socfpga_fpga_of_match); static struct platform_driver socfpga_fpga_driver = { .probe = socfpga_fpga_probe, - .remove = socfpga_fpga_remove, .driver = { .name = "socfpga_fpga_manager", .of_match_table = of_match_ptr(socfpga_fpga_of_match), From patchwork Sun Nov 15 19:51:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moritz Fischer X-Patchwork-Id: 11906769 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 583EB139F for ; Sun, 15 Nov 2020 19:54:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4599B22384 for ; Sun, 15 Nov 2020 19:54:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727876AbgKOTvk (ORCPT ); Sun, 15 Nov 2020 14:51:40 -0500 Received: from mail-pg1-f176.google.com ([209.85.215.176]:39809 "EHLO mail-pg1-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727863AbgKOTvj (ORCPT ); Sun, 15 Nov 2020 14:51:39 -0500 Received: by mail-pg1-f176.google.com with SMTP id p68so337950pga.6; Sun, 15 Nov 2020 11:51:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9kkAXw7Tt0cYJ71J1z6lzt/Cc75SkXOHsBVdYO06bFQ=; b=G5qFB+tgscIML+UFLviy89v+oyQqOsFfp0/er8iouEBguvJ2PxC76CpxSyGb6FAw5w x1qIsjI+8A+W1lxtzibm5uCF1kmpqzqYb7vgjcsBfv1U0NmjVEvS0R/pobgIRFOv12qf QBL08imvSjd1/rXbV94NGMCNZyAkfOUW+7T13c7oSgN3+PoEC+t+ok9RSCy4i2RCX6qn K4S9lb2AdZ6dIx0IM02xx18ROCFKEsKLo6kBcKVZcmln5/j6/UmoW2vAaM4lYBVhKRMO sdGZX/G2UjQkc86G9gv51denAwqstVF3tR/AJBKrzJLe5JaDW/I6P0V9FI3BoFKlI2Yx U02w== X-Gm-Message-State: AOAM531Et/wyroYcMUt3gwAo8RSxkPTZbQW1hqrwuFQKKfHAzqDl8MyB YOXCT7Z5Ni7SnmZPYzUDjU0= X-Google-Smtp-Source: ABdhPJwCT35QiWLZ8cF7fflkonArqZ3NG2yXCPxUoCQpagWVp0kBhzcGONF7SWfiv6cHMDqM5LbX1w== X-Received: by 2002:a63:5d04:: with SMTP id r4mr9961186pgb.165.1605469899212; Sun, 15 Nov 2020 11:51:39 -0800 (PST) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id v196sm16148139pfc.34.2020.11.15.11.51.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Nov 2020 11:51:38 -0800 (PST) From: Moritz Fischer To: gregkh@linuxfoundation.org Cc: linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org, trix@redhat.com, Moritz Fischer Subject: [RESEND PATCH 07/10] fpga: fpga-mgr: ts73xx: Simplify registration Date: Sun, 15 Nov 2020 11:51:24 -0800 Message-Id: <20201115195127.284487-8-mdf@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201115195127.284487-1-mdf@kernel.org> References: <20201115195127.284487-1-mdf@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fpga@vger.kernel.org Simplify registration using new devm_fpga_mgr_register() API. Reviewed-by: Tom Rix Signed-off-by: Moritz Fischer --- drivers/fpga/ts73xx-fpga.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/fpga/ts73xx-fpga.c b/drivers/fpga/ts73xx-fpga.c index 2888ff000e4d..101f016c6ed8 100644 --- a/drivers/fpga/ts73xx-fpga.c +++ b/drivers/fpga/ts73xx-fpga.c @@ -127,18 +127,7 @@ static int ts73xx_fpga_probe(struct platform_device *pdev) if (!mgr) return -ENOMEM; - platform_set_drvdata(pdev, mgr); - - return fpga_mgr_register(mgr); -} - -static int ts73xx_fpga_remove(struct platform_device *pdev) -{ - struct fpga_manager *mgr = platform_get_drvdata(pdev); - - fpga_mgr_unregister(mgr); - - return 0; + return devm_fpga_mgr_register(kdev, mgr); } static struct platform_driver ts73xx_fpga_driver = { @@ -146,7 +135,6 @@ static struct platform_driver ts73xx_fpga_driver = { .name = "ts73xx-fpga-mgr", }, .probe = ts73xx_fpga_probe, - .remove = ts73xx_fpga_remove, }; module_platform_driver(ts73xx_fpga_driver); From patchwork Sun Nov 15 19:51:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moritz Fischer X-Patchwork-Id: 11906767 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1803D139F for ; Sun, 15 Nov 2020 19:53:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 084E022384 for ; Sun, 15 Nov 2020 19:53:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727863AbgKOTvl (ORCPT ); Sun, 15 Nov 2020 14:51:41 -0500 Received: from mail-pf1-f173.google.com ([209.85.210.173]:36785 "EHLO mail-pf1-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727874AbgKOTvl (ORCPT ); Sun, 15 Nov 2020 14:51:41 -0500 Received: by mail-pf1-f173.google.com with SMTP id a18so11378730pfl.3; Sun, 15 Nov 2020 11:51:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=r/2eDS20UzGAqGhaYPkcdC2pYUk22axFOkNxIUP22Xw=; b=j4DfU2T9Ofna4UhVwYBE0FiyVvn6OmCW0z7hZ4Xs2Ad0jf7THrW7K3w+WGdG/qMCPN f2sXRp1IuzdR6usBQtSaW5offiUH9fR8uuZoj2do4s00vUSUWnTIW7IPJDyi6L7AnF6p s2ZH3TXuqvUPopYMPNp34qyt0SNDYhb5EK4dpArtTO3dE2NOC3lOoWr6vLMbMQSNNHcj 0phnKb3kbah+JrC/lnYfLw+cyWM0sEVTzso5XBdYHU+lEXX8EjGS/A/pkotHVxcIlsW3 Axw62cGsJ9CVGvTO1AQh27hy/LnUvFqgHkY6+MfcfOceBz+q3GRBS+7Sb3K/N3maDKWC t5MQ== X-Gm-Message-State: AOAM533D6lnqV1o+UnqsaQckTVteIGHVzoooHpCp9RpPhsPYR7C1YEjo /WNQWuxw0GC//2/ny5NCiOpD4Gg9aUA= X-Google-Smtp-Source: ABdhPJzjiI+oVHsUDWkWUoM7krc3mUOhSyRm2IdKh6sdo9UALFY69sK9PNWwAmcGDv5POWLWNFKspw== X-Received: by 2002:a63:570e:: with SMTP id l14mr9720158pgb.302.1605469900508; Sun, 15 Nov 2020 11:51:40 -0800 (PST) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id x18sm15415683pfi.206.2020.11.15.11.51.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Nov 2020 11:51:40 -0800 (PST) From: Moritz Fischer To: gregkh@linuxfoundation.org Cc: linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org, trix@redhat.com, Moritz Fischer Subject: [RESEND PATCH 08/10] fpga: fpga-mgr: xilinx-spi: Simplify registration Date: Sun, 15 Nov 2020 11:51:25 -0800 Message-Id: <20201115195127.284487-9-mdf@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201115195127.284487-1-mdf@kernel.org> References: <20201115195127.284487-1-mdf@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fpga@vger.kernel.org Simplify registration using new devm_fpga_mgr_register() API. Reviewed-by: Tom Rix Signed-off-by: Moritz Fischer --- drivers/fpga/xilinx-spi.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/fpga/xilinx-spi.c b/drivers/fpga/xilinx-spi.c index 824abbbd631e..27defa98092d 100644 --- a/drivers/fpga/xilinx-spi.c +++ b/drivers/fpga/xilinx-spi.c @@ -259,18 +259,7 @@ static int xilinx_spi_probe(struct spi_device *spi) if (!mgr) return -ENOMEM; - spi_set_drvdata(spi, mgr); - - return fpga_mgr_register(mgr); -} - -static int xilinx_spi_remove(struct spi_device *spi) -{ - struct fpga_manager *mgr = spi_get_drvdata(spi); - - fpga_mgr_unregister(mgr); - - return 0; + return devm_fpga_mgr_register(&spi->dev, mgr); } static const struct of_device_id xlnx_spi_of_match[] = { @@ -285,7 +274,6 @@ static struct spi_driver xilinx_slave_spi_driver = { .of_match_table = of_match_ptr(xlnx_spi_of_match), }, .probe = xilinx_spi_probe, - .remove = xilinx_spi_remove, }; module_spi_driver(xilinx_slave_spi_driver) From patchwork Sun Nov 15 19:51:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moritz Fischer X-Patchwork-Id: 11906765 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E1A67139F for ; Sun, 15 Nov 2020 19:53:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D294E22384 for ; Sun, 15 Nov 2020 19:53:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727900AbgKOTvn (ORCPT ); Sun, 15 Nov 2020 14:51:43 -0500 Received: from mail-pg1-f180.google.com ([209.85.215.180]:43975 "EHLO mail-pg1-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727899AbgKOTvm (ORCPT ); Sun, 15 Nov 2020 14:51:42 -0500 Received: by mail-pg1-f180.google.com with SMTP id 34so7529036pgp.10; Sun, 15 Nov 2020 11:51:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mxJeDzUo1JlM94sM/0JUoVzyH5QVj44C4f1rGzo7Qbs=; b=tpP/Amn4q+qgJVxw+ddxuWUoS1KDSPYAhVJdZ2EawgMtdBVUwmqzJw2GTwiFTG8vNk 3xxxqjw55RGV/NuDpcI3H5JQohOuTwhhiilb5u1PnL1TDeXKnDEUcnv9g0oSOHu+h47k 88PZK0tz0NhLaDKL19Fqfmsx9QHTNTwF9/CPGahFXXglwv+lTCnEYXNEBeqNp7NaMcrw DsixbldbkwIq27JlejigoMQhUMmHDjOspOpV5xCyxXwRII+agYP9S3flr9mbKH7PRtbU MaHAy7M1CPI1L7yFuVOo8YbXToL+JuTaaUn/9XpTL/YBICqJxmveWlVJQ2eKvvAoxMxX FDuA== X-Gm-Message-State: AOAM530VEuICzn/d1n98KiSVrmV1MahkEB2Saa2WQ3SxjzZxu7VE/X53 TqDbP8OUR6AxxuXw5fJOtHI= X-Google-Smtp-Source: ABdhPJzC7Q+r7/Q/RVac6Zis7cdiy1ml9VaZ8M/jmxT6S/3NPbqJK9isug383iQdZM8ThKzfYIuguA== X-Received: by 2002:a17:90a:1705:: with SMTP id z5mr5006456pjd.129.1605469901800; Sun, 15 Nov 2020 11:51:41 -0800 (PST) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id 64sm5530825pfe.0.2020.11.15.11.51.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Nov 2020 11:51:41 -0800 (PST) From: Moritz Fischer To: gregkh@linuxfoundation.org Cc: linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org, trix@redhat.com, Moritz Fischer Subject: [RESEND PATCH 09/10] fpga: fpga-mgr: zynqmp: Simplify registration Date: Sun, 15 Nov 2020 11:51:26 -0800 Message-Id: <20201115195127.284487-10-mdf@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201115195127.284487-1-mdf@kernel.org> References: <20201115195127.284487-1-mdf@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fpga@vger.kernel.org Simplify registration using new devm_fpga_mgr_register() API. Reviewed-by: Tom Rix Signed-off-by: Moritz Fischer --- drivers/fpga/zynqmp-fpga.c | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/drivers/fpga/zynqmp-fpga.c b/drivers/fpga/zynqmp-fpga.c index 4a1139e05280..125743c9797f 100644 --- a/drivers/fpga/zynqmp-fpga.c +++ b/drivers/fpga/zynqmp-fpga.c @@ -95,7 +95,6 @@ static int zynqmp_fpga_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct zynqmp_fpga_priv *priv; struct fpga_manager *mgr; - int ret; priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) @@ -108,24 +107,7 @@ static int zynqmp_fpga_probe(struct platform_device *pdev) if (!mgr) return -ENOMEM; - platform_set_drvdata(pdev, mgr); - - ret = fpga_mgr_register(mgr); - if (ret) { - dev_err(dev, "unable to register FPGA manager"); - return ret; - } - - return 0; -} - -static int zynqmp_fpga_remove(struct platform_device *pdev) -{ - struct fpga_manager *mgr = platform_get_drvdata(pdev); - - fpga_mgr_unregister(mgr); - - return 0; + return devm_fpga_mgr_register(dev, mgr); } static const struct of_device_id zynqmp_fpga_of_match[] = { @@ -137,7 +119,6 @@ MODULE_DEVICE_TABLE(of, zynqmp_fpga_of_match); static struct platform_driver zynqmp_fpga_driver = { .probe = zynqmp_fpga_probe, - .remove = zynqmp_fpga_remove, .driver = { .name = "zynqmp_fpga_manager", .of_match_table = of_match_ptr(zynqmp_fpga_of_match), From patchwork Sun Nov 15 19:51:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moritz Fischer X-Patchwork-Id: 11906763 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AFA50697 for ; Sun, 15 Nov 2020 19:53:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A142822384 for ; Sun, 15 Nov 2020 19:53:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727913AbgKOTvo (ORCPT ); Sun, 15 Nov 2020 14:51:44 -0500 Received: from mail-pf1-f176.google.com ([209.85.210.176]:38350 "EHLO mail-pf1-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727899AbgKOTvo (ORCPT ); Sun, 15 Nov 2020 14:51:44 -0500 Received: by mail-pf1-f176.google.com with SMTP id 10so11372509pfp.5; Sun, 15 Nov 2020 11:51:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eHdU5oxW9fYEoWkH8yF79mOZPyoTqXNwEc+aAMEPYfM=; b=l0lUcbtDvKVI+Vhf62WvTL5I778jNxXDeb27or4k5vs4eAFRDZBKfhwBgEyiGbC3Gh V4/SrzCpBUn8/iyW94YOb/5aufG1zQB9jFyk40YImF9pkfO/gGCpmlf9wIojU1Z8ZNQS 8EPvkH/jV9rEha7GqO6h4zNy/uUdkAsgmdKFYmPWoxHbIu6VE2kOKTFuXPAbqlvlRrRN nLFqnUw/hcob3A+H8Xv1wHdi1c94mLm95xhBHu6fiJSS5eFxSx3M7Hexx9Xb7Qg85LDP k3Wfbzrb/fO2BUlX5eCMDRal/Bvg2DswLJbB9CrGn5zSZQeti8QALGAapBqcCTtfUXUR v+Rg== X-Gm-Message-State: AOAM530SfpUs5Nk+BeCC7/uGFfLE6vEiKcyusZoQm5iYuaOyUZ/4W0u4 4Nay6mWaH0AfJ6nInbIzvGk= X-Google-Smtp-Source: ABdhPJxnNurbeDGCpGCPLiL/9ifN4GMgcB3yzHosfd3RB5CxhkxvOA4De9E8dWX6j0SUvkbyed1QVg== X-Received: by 2002:a05:6a00:1693:b029:155:abe5:caa2 with SMTP id k19-20020a056a001693b0290155abe5caa2mr11025955pfc.39.1605469903175; Sun, 15 Nov 2020 11:51:43 -0800 (PST) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id e9sm14879167pgi.5.2020.11.15.11.51.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Nov 2020 11:51:42 -0800 (PST) From: Moritz Fischer To: gregkh@linuxfoundation.org Cc: linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org, trix@redhat.com, Moritz Fischer Subject: [RESEND PATCH 10/10] fpga: fpga-mgr: altera-pr-ip: Simplify registration Date: Sun, 15 Nov 2020 11:51:27 -0800 Message-Id: <20201115195127.284487-11-mdf@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201115195127.284487-1-mdf@kernel.org> References: <20201115195127.284487-1-mdf@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fpga@vger.kernel.org Simplify registration using new devm_fpga_mgr_register() API. Reviewed-by: Tom Rix Signed-off-by: Moritz Fischer --- drivers/fpga/altera-pr-ip-core-plat.c | 10 ---------- drivers/fpga/altera-pr-ip-core.c | 4 +--- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/fpga/altera-pr-ip-core-plat.c b/drivers/fpga/altera-pr-ip-core-plat.c index 99b9cc0e70f0..b008a6b8d2d3 100644 --- a/drivers/fpga/altera-pr-ip-core-plat.c +++ b/drivers/fpga/altera-pr-ip-core-plat.c @@ -28,15 +28,6 @@ static int alt_pr_platform_probe(struct platform_device *pdev) return alt_pr_register(dev, reg_base); } -static int alt_pr_platform_remove(struct platform_device *pdev) -{ - struct device *dev = &pdev->dev; - - alt_pr_unregister(dev); - - return 0; -} - static const struct of_device_id alt_pr_of_match[] = { { .compatible = "altr,a10-pr-ip", }, {}, @@ -46,7 +37,6 @@ MODULE_DEVICE_TABLE(of, alt_pr_of_match); static struct platform_driver alt_pr_platform_driver = { .probe = alt_pr_platform_probe, - .remove = alt_pr_platform_remove, .driver = { .name = "alt_a10_pr_ip", .of_match_table = alt_pr_of_match, diff --git a/drivers/fpga/altera-pr-ip-core.c b/drivers/fpga/altera-pr-ip-core.c index 2cf25fd5e897..5b130c4d9882 100644 --- a/drivers/fpga/altera-pr-ip-core.c +++ b/drivers/fpga/altera-pr-ip-core.c @@ -195,9 +195,7 @@ int alt_pr_register(struct device *dev, void __iomem *reg_base) if (!mgr) return -ENOMEM; - dev_set_drvdata(dev, mgr); - - return fpga_mgr_register(mgr); + return devm_fpga_mgr_register(dev, mgr); } EXPORT_SYMBOL_GPL(alt_pr_register);