From patchwork Mon Oct 5 17:37: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: 11817135 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 903B86CA for ; Mon, 5 Oct 2020 17:38:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 772EA207EA for ; Mon, 5 Oct 2020 17:38:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601919523; bh=hUixJ/oSPOHJ6/B/aba4MSMAPGii3FwQ8BpPQx07vy8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=zRdm7yrkqEoyYsj6iKvGCsAuFCfqrI0pNtZJ3WHUrecBPoHCvdzuc+yOG/dXYNQ3g SIdUGxiQ+WCptYjO6yJ6gM49Vo/W+qUVD66t5D5HXA64gijRjF8z/RbJH2EpQ5U+pI oGH0ip+YJiUlVsHLuEtaJnm7qQ1cVtvZDvx9XATw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729093AbgJERic (ORCPT ); Mon, 5 Oct 2020 13:38:32 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:46823 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729076AbgJERhq (ORCPT ); Mon, 5 Oct 2020 13:37:46 -0400 Received: by mail-pg1-f195.google.com with SMTP id 34so6422029pgo.13; Mon, 05 Oct 2020 10:37:45 -0700 (PDT) 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=tybOLLtw84rXzj8SWCLjMJDPl0218bwFPqf/Udii/sQ=; b=gcM5z7bzg0+lejc1Nc12Ye8ZX+mFgQo66Nk4U3jtdaE/dVHhH1W7IVpVT8UHHLlmAe Am/Qe2gi+iMeMTLUnselnIkWEXf8+Sfo20p6h/wvUq+FUaAtOk4OXcehsXn3hJ07vt8C kKjQGOXmLULBAqUI+iryyrb5G8+FDhQwx4ZcepkAfqHhVuar+7X44Vw4Ob1IC1bmgEAJ Ct93tdYZ86K3a+1+4wIoLpxYTx0az0GAM29SI5zTQBE1Ww8aSkmReLvHlHHpTrKptleZ KEVC9TZV/RgklSeF4KH6iV/sycuwfGWNQmxcAX+jp3wMCTkQSEWax8AUY0li5CchCIbw G9hA== X-Gm-Message-State: AOAM532/Ffa/fA7TD88qryPkgxYp0dyArLHaK7+aI8KG+vxx6g5ZI881 0VBpZ03aBux7eetrdrsPfZ7GbY/iGBE= X-Google-Smtp-Source: ABdhPJyx9fuPbSBu4xIJRLHVID+oD5yS5Ng1RbS88t2JGKT08aMhnSmNock/loTlXeSrXdv2rF1eDA== X-Received: by 2002:aa7:9522:0:b029:142:2501:3986 with SMTP id c2-20020aa795220000b029014225013986mr599718pfp.75.1601919464820; Mon, 05 Oct 2020 10:37:44 -0700 (PDT) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id g1sm183977pjl.21.2020.10.05.10.37.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Oct 2020 10:37:43 -0700 (PDT) From: Moritz Fischer To: linux-fpga@vger.kernel.org Cc: trix@redhat.com, hao.wu@intel.com, michal.simek@xilinx.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, russell.h.weight@intel.com, matthew.gerlach@intel.com, Moritz Fischer Subject: [PATCH v2 01/10] fpga: fpga-mgr: Add devm_fpga_mgr_register() API Date: Mon, 5 Oct 2020 10:37:26 -0700 Message-Id: <20201005173735.162408-2-mdf@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201005173735.162408-1-mdf@kernel.org> References: <20201005173735.162408-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 Mon Oct 5 17:37: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: 11817137 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 B9DBA112E for ; Mon, 5 Oct 2020 17:38:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 98DF420FC3 for ; Mon, 5 Oct 2020 17:38:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601919523; bh=Bda571/FOidGJnkYw332UCs/rRFO0C+pwRXuw6eYVL4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=B14INT+mMfkg+ZtmeXMnCuoaorGGOCMv+WJV/8m+GZbS0SF6bUvoKRl4YKPNPnriW ZXFQ7r4YTqYhx4DnPTaTGhyJSe7sMpYJrVYNfZQOhmvl09o2XotIddQKg6MxrVzDdf e8JtAynIB2zRbxPezhOayz3SRJyE+RZQ/WikK7JA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728492AbgJERic (ORCPT ); Mon, 5 Oct 2020 13:38:32 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:42221 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729078AbgJERhr (ORCPT ); Mon, 5 Oct 2020 13:37:47 -0400 Received: by mail-pg1-f196.google.com with SMTP id m34so6439894pgl.9; Mon, 05 Oct 2020 10:37:46 -0700 (PDT) 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=wdqITJDQRbpmmuyzbiSajCMT3fTgONqCxlfl7IqR5tU=; b=ngfdJM0IEh4BrRmG7lH5W8DjBMMJq/L8H1NX3YiAAokj6Jh0GFyTuQ5HwclMbYBIrv wgQ+VqhtoGLUJRHt0ie3cM++3hE7PK9X5hAWGHbkyl8nL/Ed23tiJb7v1NvwAKkV1mIq ZIAvpL6iy2pUt6hD4FFYluVb/ZI17rQDCdwpV/TAh3ZaSvD7gM01/uLtnQw5w3oSGSHK Iejepz81C8NM+ZTSk3xo83gDk2Z+7YbJfG76t1IMe8/tzpNNsBhu6AvwzgJzEDe/a9vS CZyP+EZIoRACOuHCys3Rk+9TQw8WQtKVGUlE2P3UV2A9qgggkKgHe0vCZ7YOnL6WhTob dJcw== X-Gm-Message-State: AOAM5320O/g9N1rmgTI+TfDEhA0sj3jZ2lvur5y6jdzLnq6rwe1Pt9ZV g28btRTRD3+smsRwnNIGDnSG2ArxCKQ= X-Google-Smtp-Source: ABdhPJyEAGXc53tWtwzjvRMpUKdIkNcVVRhtV1iI9clNxea1rhdeEQ09BgMlQgzbOvT87bj9SQxytQ== X-Received: by 2002:a63:3d8c:: with SMTP id k134mr592201pga.22.1601919466093; Mon, 05 Oct 2020 10:37:46 -0700 (PDT) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id g9sm225231pgm.79.2020.10.05.10.37.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Oct 2020 10:37:45 -0700 (PDT) From: Moritz Fischer To: linux-fpga@vger.kernel.org Cc: trix@redhat.com, hao.wu@intel.com, michal.simek@xilinx.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, russell.h.weight@intel.com, matthew.gerlach@intel.com, Moritz Fischer Subject: [PATCH v2 02/10] fpga: fpga-mgr: altera-ps-spi: Simplify registration Date: Mon, 5 Oct 2020 10:37:27 -0700 Message-Id: <20201005173735.162408-3-mdf@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201005173735.162408-1-mdf@kernel.org> References: <20201005173735.162408-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 Mon Oct 5 17:37:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moritz Fischer X-Patchwork-Id: 11817109 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 3D169618 for ; Mon, 5 Oct 2020 17:37:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 227EA2083B for ; Mon, 5 Oct 2020 17:37:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601919475; bh=NHZ8Rk91MiI0FB7HDZEhyWSXCjMu40buN90hK2CVieM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=VdgG978SutPkrJiXUBJIvyGWaFHgWZ3EOj/qnJr4XeexkxxG6bYaUD514s8Mx9tVL 9/vSZIT2V94/HueRZ13sczH6lReI1wGqWxRHOcRvh7sPqpNoAzgaxcou73IkHVH/TC 1oXvig9HD+7YyXwf+zttNByQlJJimhHaARNH/tIk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729067AbgJERhy (ORCPT ); Mon, 5 Oct 2020 13:37:54 -0400 Received: from mail-pf1-f173.google.com ([209.85.210.173]:41026 "EHLO mail-pf1-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729027AbgJERhs (ORCPT ); Mon, 5 Oct 2020 13:37:48 -0400 Received: by mail-pf1-f173.google.com with SMTP id g10so4157434pfc.8; Mon, 05 Oct 2020 10:37:47 -0700 (PDT) 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=ThjGMNgrLrI2Onk47mH0ZJ6H9pM2blvwAMK0KJCWHWs=; b=AGyp/1tfM9s/Kfp85D2r9QJvh9PQJC3Sf5wVaSYu1lFDJnQ7D6mQokZ0N28Roqr8fy WwwGNt/QAXXpeifFlsjP2TKIGt2qptD3qFXfLDp1nCZH21ZxPVVoXuNU815tbKpTPllZ U7heK05k6kWKmpKsrDnaPbDGXeQZGKI6o3I0gLVXGAcHY2d4x6cukQM7q64yaRYSQclY c46VdHHQf1AHWLlwZnpzt90Emtm0ySWly8fSm/QsSuqvSppSgMP60IvgcRIbxjcmi60s gbsIan42DqGBAjJMt0u3UPLxqZLFCLB3DRUIeBddSdvIQ1LGRGuFEE9g6sbfs7b81BCd 3ORQ== X-Gm-Message-State: AOAM531u8GdArFt9wS1cOmleCP5myaogwF1MEFHAXXsL/393SawXtBct HJfYTAXpCf8iR7wYR+8+vOTZso9Vh+c= X-Google-Smtp-Source: ABdhPJxEdp5j5KzsM62NicgFATzxlcJoG8NRfOiT4HPR0BHeK2mXx3G8hMQ0HgCYon8j3czzKKqecA== X-Received: by 2002:a62:e308:0:b029:152:8cc3:ebdc with SMTP id g8-20020a62e3080000b02901528cc3ebdcmr663995pfh.42.1601919467294; Mon, 05 Oct 2020 10:37:47 -0700 (PDT) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id a185sm232173pgc.46.2020.10.05.10.37.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Oct 2020 10:37:46 -0700 (PDT) From: Moritz Fischer To: linux-fpga@vger.kernel.org Cc: trix@redhat.com, hao.wu@intel.com, michal.simek@xilinx.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, russell.h.weight@intel.com, matthew.gerlach@intel.com, Moritz Fischer Subject: [PATCH v2 03/10] fpga: fpga-mgr: dfl-fme-mgr: Simplify registration Date: Mon, 5 Oct 2020 10:37:28 -0700 Message-Id: <20201005173735.162408-4-mdf@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201005173735.162408-1-mdf@kernel.org> References: <20201005173735.162408-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 Mon Oct 5 17:37:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moritz Fischer X-Patchwork-Id: 11817131 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 A6D4B6CA for ; Mon, 5 Oct 2020 17:38:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 846F320853 for ; Mon, 5 Oct 2020 17:38:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601919507; bh=mzpC0e7xhFNk/3z387JFrAhr61lCGIO+XgnS19XzI2A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=K3Yok44LfTZM5FW+D1MrMxtRDEgPXgV2BbjegqrBTNyZmHF2Mza8yonAIA/bTxU9n pq5zIVHiguybcBUXBKpcbcup5sw2ORxyVqTqp8yeMtveVNfY1Q24EmhY5b8wXkxICZ i8JDnmUJtHgUsgKfu8h1SLeQob6WjR5V0m5LaqsQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729001AbgJERi1 (ORCPT ); Mon, 5 Oct 2020 13:38:27 -0400 Received: from mail-pg1-f180.google.com ([209.85.215.180]:40447 "EHLO mail-pg1-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728151AbgJERht (ORCPT ); Mon, 5 Oct 2020 13:37:49 -0400 Received: by mail-pg1-f180.google.com with SMTP id i2so2736196pgh.7; Mon, 05 Oct 2020 10:37:49 -0700 (PDT) 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=IjZwZs24cnHRvJI8qZINqO75sV6sdKQ+viQiqkSfwzU=; b=Sd5XuzoTha9nyBqUoeIvW1Hqii4b6B8Lxd54RzjKfoEXRISA9x6BXyh/88T9LtAOey 9F4RbsC/0r4ToR+zZEbpWLcr4JPm1n8JDv+EJc2Tpvoh32y0cmtDBT1lTKrG6Vqfmitm 6uVoOMHR8mbVDoKp0ZQ70/ew3htohEPC/MUkPf/mw09yDJi3hERr9oH/OkkGMlGupbAI WXEGXLYzbguS55KX9U/zgN1592mV8H2+gZjHeDcl4FhbepA3wlFtfaA7UpVHNqU3NM+1 HvtblsjJYCkLFD916cy1LPDOUMq1uF86zJU9koUwWLkYDntKbYRJVYUrU8o+ewn0Rjr4 ccVQ== X-Gm-Message-State: AOAM530uwrY2/+VD1s29tNhaUQM77H26nNND6qGImXogyk3YOjOZ8Dt8 im6h6OZxk0F67E+5CSytkuq4qlBFJ/E= X-Google-Smtp-Source: ABdhPJz+xTZGsV+G9I/y4Tu5r6e6ngwl1Wdi2JL23ASYEWVc9SGhzTOe+58nfh7bc/SlSiNneHHtCw== X-Received: by 2002:a62:52ce:0:b029:13e:50c8:499b with SMTP id g197-20020a6252ce0000b029013e50c8499bmr905498pfb.14.1601919468616; Mon, 05 Oct 2020 10:37:48 -0700 (PDT) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id q16sm486765pfu.206.2020.10.05.10.37.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Oct 2020 10:37:48 -0700 (PDT) From: Moritz Fischer To: linux-fpga@vger.kernel.org Cc: trix@redhat.com, hao.wu@intel.com, michal.simek@xilinx.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, russell.h.weight@intel.com, matthew.gerlach@intel.com, Moritz Fischer Subject: [PATCH v2 04/10] fpga: fpga-mgr: ice40-spi: Simplify registration Date: Mon, 5 Oct 2020 10:37:29 -0700 Message-Id: <20201005173735.162408-5-mdf@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201005173735.162408-1-mdf@kernel.org> References: <20201005173735.162408-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 Mon Oct 5 17:37:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moritz Fischer X-Patchwork-Id: 11817125 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 74F7B618 for ; Mon, 5 Oct 2020 17:38:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5BF892083B for ; Mon, 5 Oct 2020 17:38:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601919505; bh=9uOvBRLf1I6IXMb1/mCwowS06jO5LUOYP/e7+K/04Ig=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=FZsAb/1U9DG4/N030J1V96OEOAiBFX83+K/1lxFXYaJm7PbSxAf8iQl6hMNeOj2vd trPcxBv88Cj3q6OYLeq0oUlJtLc8pKkoDKfbjS0+9DNSCKHaN+zUorV3F/Lcuo05yR ns1XqFw3QLZUcSfv59rZ9UFOJMRDpS59KpLGVcjY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729125AbgJERiO (ORCPT ); Mon, 5 Oct 2020 13:38:14 -0400 Received: from mail-pj1-f45.google.com ([209.85.216.45]:33453 "EHLO mail-pj1-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729085AbgJERhu (ORCPT ); Mon, 5 Oct 2020 13:37:50 -0400 Received: by mail-pj1-f45.google.com with SMTP id t23so346919pji.0; Mon, 05 Oct 2020 10:37:50 -0700 (PDT) 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=PJinqLCKTDe+aRSItigFp/wrvpdMWTGVdNBIcRnfBzA=; b=VE/0o6BDpOLu9ao59vZ3LCuk1IajfIR/w+lYnL2ZEi4wUdhWdfd9g+tRvr9pEs3OB8 j/FY72XvaaKtRmSFk+8AFAu793nojdTGjv6gS6OwGVRWCPq0WjvHAGQqQ9bRBJWSkJHa 64Pc2rgw2Ay2wj9+loPj+TM9y4q7yAN07sD6p7BkWNBgqDMS9Yt6znTC+fGxd7l7OJRb UB6KeIJt/GI9TytrIOPrLhyr7RcmG5m5xWtTAPEPYwDo48XCsHUEZP+xr+Lx9Km9vW5I OvwUxP/6ncjbCfnaySmMsD9lUqajwKXReCpKG5NJ+EO227emT7AgfoCYT8kOTMl8VIQJ +K+w== X-Gm-Message-State: AOAM531c2uoVF/aEA8sZjaIym6OU6V3iMmeZz/Uy2GSWviLWl7ZcfFsV NhgcPp0+QqLDfoyonB9hdoNw3Ac83b8= X-Google-Smtp-Source: ABdhPJwdvnEtZIDBh4qK3r1xDzccd0E4i+usLvtnb/8vdfe8iRjZfHrJt9UaCm9t4fceQLtH0RmFZA== X-Received: by 2002:a17:90b:f8b:: with SMTP id ft11mr544364pjb.8.1601919469830; Mon, 05 Oct 2020 10:37:49 -0700 (PDT) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id az18sm181250pjb.35.2020.10.05.10.37.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Oct 2020 10:37:49 -0700 (PDT) From: Moritz Fischer To: linux-fpga@vger.kernel.org Cc: trix@redhat.com, hao.wu@intel.com, michal.simek@xilinx.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, russell.h.weight@intel.com, matthew.gerlach@intel.com, Moritz Fischer Subject: [PATCH v2 05/10] fpga: fpga-mgr: machxo2-spi: Simplify registration Date: Mon, 5 Oct 2020 10:37:30 -0700 Message-Id: <20201005173735.162408-6-mdf@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201005173735.162408-1-mdf@kernel.org> References: <20201005173735.162408-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 Mon Oct 5 17:37:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moritz Fischer X-Patchwork-Id: 11817127 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 B0FFF618 for ; Mon, 5 Oct 2020 17:38:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8F13A2080A for ; Mon, 5 Oct 2020 17:38:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601919506; bh=zfSk9qK/d/pG8UF1gaa2i4asbpvVe42srkJj3+OgDQs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=exd0IhAm00uAcrdGaaFOJfAUBsMoqTfMN/tVKzvH/o6xggNeiVm+FA576HWTRU36N 61WGIjQCr7qz+vleg+kPPM4yxAShG/5dT2A45hgM1oPBqT1dSc3ND+M3Fzl67eKM4x CJ+Y7uYkbTij0Rb9R7plvPCaq9bwUAgCRtqGQQ+w= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729043AbgJERiN (ORCPT ); Mon, 5 Oct 2020 13:38:13 -0400 Received: from mail-pj1-f49.google.com ([209.85.216.49]:35652 "EHLO mail-pj1-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729023AbgJERhw (ORCPT ); Mon, 5 Oct 2020 13:37:52 -0400 Received: by mail-pj1-f49.google.com with SMTP id x2so219115pjk.0; Mon, 05 Oct 2020 10:37:51 -0700 (PDT) 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=l6D4+DnleUV85fmaN7MdBVnGTrFax41kLnobja/AhDw=; b=tYkhVSC12DcfCYwHq8jHqw1wOXqRcyZ5Cgxcfi37kVzkoDC4lkmaqilvX4viytsiAJ j/aJwOo2lXGvTHIbK3M9LR3/zLS+b9t/YXiCDqoqNvwmjcLOi83v+Saz2vIWmbdEampL GW7lfulWgF33SJKmQk38MI5WYWUdCBHgBs06XZPo9/6+i+ZSDCUQhIr1u5zenBlj/dSS 54FUEbLuYstEKvehXq5RDUyKkMNt+GMBLINwyEhPCa7yRZDkyG7l/jp3cWDkkeDySNEA 8FI15QJ69FcCCmtkeBZeG1Dd4RKQ9/yipyWuWxMX/B8gCvBP7M0okwdkKKe9WTvWC6MW 2elw== X-Gm-Message-State: AOAM533NE586VHN0/MRQTmZkc4ptPuLNuXMZoBiCKdrBY8BvF8QBwNKY kNaWORLFW8tcwL+vp3MFPDn4ZvaH1YU= X-Google-Smtp-Source: ABdhPJxCACUo/RF7tmZdJ2UVUvDmOhvyynY18dFOWxStNR0l0MYGcBAjTIB5fTRyGhPf6lUf8jWKig== X-Received: by 2002:a17:90a:a512:: with SMTP id a18mr549922pjq.30.1601919471028; Mon, 05 Oct 2020 10:37:51 -0700 (PDT) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id g9sm225383pgm.79.2020.10.05.10.37.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Oct 2020 10:37:50 -0700 (PDT) From: Moritz Fischer To: linux-fpga@vger.kernel.org Cc: trix@redhat.com, hao.wu@intel.com, michal.simek@xilinx.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, russell.h.weight@intel.com, matthew.gerlach@intel.com, Moritz Fischer Subject: [PATCH v2 06/10] fpga: fpga-mgr: socfpga: Simplify registration Date: Mon, 5 Oct 2020 10:37:31 -0700 Message-Id: <20201005173735.162408-7-mdf@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201005173735.162408-1-mdf@kernel.org> References: <20201005173735.162408-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 Mon Oct 5 17:37:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moritz Fischer X-Patchwork-Id: 11817119 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 01762618 for ; Mon, 5 Oct 2020 17:38:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DD4B12083B for ; Mon, 5 Oct 2020 17:38:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601919489; bh=GGRWnIRMYVvbhIfOoLd98sNSsmoBZzxa9UW/3qZPpNY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=QxF/NrwitLNPUEF+KxAuJxiIJ7bDdxR9HooKHWsuivFeddvVqvtqzthwKhGxW6k7U qqZdzgjqDpIv+JH9WWHlY/7KYJMOIJ062OJAaVtxUgX9dHoF9RD4L9jIp/N+Iq04Gm 54AB6fMPQvo0bmFHbCBuXLtObFnvnNVrNt75Nm9c= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728053AbgJERiJ (ORCPT ); Mon, 5 Oct 2020 13:38:09 -0400 Received: from mail-pj1-f49.google.com ([209.85.216.49]:56196 "EHLO mail-pj1-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729043AbgJERhx (ORCPT ); Mon, 5 Oct 2020 13:37:53 -0400 Received: by mail-pj1-f49.google.com with SMTP id ds1so185537pjb.5; Mon, 05 Oct 2020 10:37:52 -0700 (PDT) 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=/4TUUEH3mzxdF0JLPfTx+3VTCs6mAY0is3dcpH6g8XA=; b=unSrdQ+aau+N4XCVEHakL7yJddhR0UMzXbhjCaT1dKf1qf3omUqZbkxc0Mfn80cPUN 7+XOlPFX6AiUtIkpxh5tBLvNDSdmzIPbNz75sBQl45QFXdxBIRIINMJp2ocCaCE97bwT FUf8qbQjXG6hYl0cScHgN77IbRK+yj0bKLTkYxFbAwXdvxURaTv03jJxiefaWjyud4uh 6FWTW86EXtjSdL+AMRekKdXz8wo3CxJTqw/rnmUHDam4SK51NsTN4zgbFqvG8K8ujmeF +oOszVOVdhjClgnzN28wpnxUGoVs4EMzEUu0Iy/lmW2rGAdZ2WydoXHTg4+DzFxoT936 zQqg== X-Gm-Message-State: AOAM531cMB6nsfW5d5mD5hxYJMyWOdijsFuCTy8Izxnsx9Aiu/nbTozu 7C2oZ4PaRQJzDm7kLZWbZFHqntEvqtk= X-Google-Smtp-Source: ABdhPJx4xXhbH1MWDvuiwBaaC/6SkRVdBbdml4IF7pL/5w77qJGI1HZWaZKi64MmXkAUtT5IDwCo6w== X-Received: by 2002:a17:90a:5588:: with SMTP id c8mr494907pji.224.1601919472219; Mon, 05 Oct 2020 10:37:52 -0700 (PDT) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id v22sm497846pff.159.2020.10.05.10.37.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Oct 2020 10:37:51 -0700 (PDT) From: Moritz Fischer To: linux-fpga@vger.kernel.org Cc: trix@redhat.com, hao.wu@intel.com, michal.simek@xilinx.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, russell.h.weight@intel.com, matthew.gerlach@intel.com, Moritz Fischer Subject: [PATCH v2 07/10] fpga: fpga-mgr: ts73xx: Simplify registration Date: Mon, 5 Oct 2020 10:37:32 -0700 Message-Id: <20201005173735.162408-8-mdf@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201005173735.162408-1-mdf@kernel.org> References: <20201005173735.162408-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 Mon Oct 5 17:37:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moritz Fischer X-Patchwork-Id: 11817111 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 E38BB618 for ; Mon, 5 Oct 2020 17:37:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CABCE207EA for ; Mon, 5 Oct 2020 17:37:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601919476; bh=IzS88frmHV/0Kvejejb4rLFBDQ4hiJR1mgHFKO8Ecxo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=I6cmBe59X41Evt/2NIzhPKbI6AMucOU/Spw8w+dTDT2OlgZ5JKdgccwoRZ9GjWBJF N6FjJD7l+1in3Ha/lahYCpebo7BAlxUcZyKjbCfEOCyRmLeY8G2fji3iTr43G6nAF/ wZXIzjh2/FwfLaJdhc5/cAQQeWwGgj5wjJe/nBpI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729064AbgJERh4 (ORCPT ); Mon, 5 Oct 2020 13:37:56 -0400 Received: from mail-pg1-f181.google.com ([209.85.215.181]:34718 "EHLO mail-pg1-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729088AbgJERhz (ORCPT ); Mon, 5 Oct 2020 13:37:55 -0400 Received: by mail-pg1-f181.google.com with SMTP id u24so6457097pgi.1; Mon, 05 Oct 2020 10:37:54 -0700 (PDT) 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=S5exJHrExp6hH+fiLalmCGHAHxK2W/BK4vVbjWgODn4=; b=CAd7ejEaBXrxMRMsnW2WhJG0sd25eaKkG+RMlZJ7dL3Ww+I5yibSz5T/QRGgcJxqtG JYTq8BV8cwqbFeLaROVHZ0qFQXBqbEkOqSBbb/v+5s/XhTyMHUmo4vKVrTLVtXKyAF3W U/eINnIPYCLYn6vTPDEULPRTj7qpXXTml0v1ST6gXDi9vhIVZfQJjuOTk9KTZaKn9eTP DJ7ZmuiFegNf2/o1/ol/8FE7ZKau4TS2j2j+G9Y8vZcfwrMwpWijQYADPAIc33QxvfUt TuTgNiPWz0cs1PeppVibv0LxpToCz7+Xst8lhmZ83AG+f7h+QjJzlk1SQUSoo0fPN+Pe XndA== X-Gm-Message-State: AOAM532+5A5RsLmEdEYhXEstxx9eZwRzSzr6JMYVm1BLJTPxuucf8UzK +WrbdRk35ZlvaUvtdkxAcaYXrSaNkxY= X-Google-Smtp-Source: ABdhPJx+vPTMXgGqXUfLGXSmTwUGiHqJ1pGXF30jVnvKd2Kzjtnaau7tvdWmbper+dTMFbKEvw9Duw== X-Received: by 2002:a62:54c4:0:b029:142:2501:34d3 with SMTP id i187-20020a6254c40000b0290142250134d3mr871545pfb.44.1601919473565; Mon, 05 Oct 2020 10:37:53 -0700 (PDT) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id f17sm533028pfq.141.2020.10.05.10.37.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Oct 2020 10:37:53 -0700 (PDT) From: Moritz Fischer To: linux-fpga@vger.kernel.org Cc: trix@redhat.com, hao.wu@intel.com, michal.simek@xilinx.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, russell.h.weight@intel.com, matthew.gerlach@intel.com, Moritz Fischer Subject: [PATCH v2 08/10] fpga: fpga-mgr: xilinx-spi: Simplify registration Date: Mon, 5 Oct 2020 10:37:33 -0700 Message-Id: <20201005173735.162408-9-mdf@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201005173735.162408-1-mdf@kernel.org> References: <20201005173735.162408-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 Mon Oct 5 17:37:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moritz Fischer X-Patchwork-Id: 11817113 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 36A76618 for ; Mon, 5 Oct 2020 17:38:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1E8402083B for ; Mon, 5 Oct 2020 17:38:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601919483; bh=WCq/vxO/PMTSrDtJxa3PzsBVJJuIHKuvjvB1HLIcc3o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=CSL7NerX6BHsDbpVn/8+NHfEnJQRnokVG6dSauvHzOpBP5AxcQblhynru6aX0UMit eRHYGLgXEvJk54ayHML/dU+E5iu+4ksyPIqSN89JI6rycw0ghv9Qg5cgtQCLjEB9Nc UIT1DincBPB6J9Kmcqo9AAeMkQm7/YUKbI+477xE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729090AbgJERh4 (ORCPT ); Mon, 5 Oct 2020 13:37:56 -0400 Received: from mail-pf1-f177.google.com ([209.85.210.177]:35429 "EHLO mail-pf1-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729087AbgJERhz (ORCPT ); Mon, 5 Oct 2020 13:37:55 -0400 Received: by mail-pf1-f177.google.com with SMTP id k8so7422108pfk.2; Mon, 05 Oct 2020 10:37:55 -0700 (PDT) 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=J3XiBxLGBeSPFpAxZt+y5k3Cj/REy00FOrYxsXzSQuQ=; b=uYGFVRH43eX3gLlICl5ihCn4o3B8OysOsbrufZLqHqMlBWBwMWCsmwtoHRjVGs++eq jeo+jq5qJe5qqNXi0ye4cAMjl8duJ+UZhruUe8/sV9F4e0P+646SsJLw25rc1quk6oAP cFN5zdh1PrzH4ibmifAeI58dQLnGGkZD/ZNNygSfScPdlzdffTyHKDu5dxB+k8TdMmiO ewFtzAK4jbD8QwY6tEaM+H7kvF2qUiKEEHWKS4qV9hu/9vG5fGFO1/NeKCtyVrkrMkPE 6qEv3ym2QHEXwziJ5WB1mhMYL4+iky5ke6gAawCaf3h5mEttHxEH5vzuhb+TE1azlkS/ JQlQ== X-Gm-Message-State: AOAM531u3UEVxryLvTjBrTU+TqspN8H6Tr9tAU7UQVvc5eiBTjRTNoUK +jQwUW2GDWuzrmuIHJTpOzJjn3ZQ/Fo= X-Google-Smtp-Source: ABdhPJyTtaSdPJRw1sHYWV0r1e3crx8Fd03UNMOyBkViknTat2ryvDRa43qd8CEpMlLrudH6Qa0F+w== X-Received: by 2002:a62:3541:0:b029:13f:ebd9:ad5c with SMTP id c62-20020a6235410000b029013febd9ad5cmr682191pfa.30.1601919474814; Mon, 05 Oct 2020 10:37:54 -0700 (PDT) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id f17sm533065pfq.141.2020.10.05.10.37.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Oct 2020 10:37:54 -0700 (PDT) From: Moritz Fischer To: linux-fpga@vger.kernel.org Cc: trix@redhat.com, hao.wu@intel.com, michal.simek@xilinx.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, russell.h.weight@intel.com, matthew.gerlach@intel.com, Moritz Fischer Subject: [PATCH v2 09/10] fpga: fpga-mgr: zynqmp: Simplify registration Date: Mon, 5 Oct 2020 10:37:34 -0700 Message-Id: <20201005173735.162408-10-mdf@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201005173735.162408-1-mdf@kernel.org> References: <20201005173735.162408-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 Mon Oct 5 17:37:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moritz Fischer X-Patchwork-Id: 11817115 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 A3620112E for ; Mon, 5 Oct 2020 17:38:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8B4862083B for ; Mon, 5 Oct 2020 17:38:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601919483; bh=96c7FIQ/jYynA8nPntrJum0d6ZPBvhaIZetraSF1hZA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=p/7rbhvtuh9iBCp9cheAVj5KyKYkyk2AX9f0+pd1CiOHYP3NrqBQ5CRKmC/vKWbNp H4EpE+9wteBRmlbi/nWVDd3Px+6n26objfuBGm0KqEbFOlqNst8JPs5xYPWZ4L6yY8 XN3j5fuI2houO3RIIPtOzG93TI2M/XmxrPCKfktQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729086AbgJERiC (ORCPT ); Mon, 5 Oct 2020 13:38:02 -0400 Received: from mail-pg1-f173.google.com ([209.85.215.173]:39616 "EHLO mail-pg1-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729096AbgJERh4 (ORCPT ); Mon, 5 Oct 2020 13:37:56 -0400 Received: by mail-pg1-f173.google.com with SMTP id 22so2502098pgv.6; Mon, 05 Oct 2020 10:37:56 -0700 (PDT) 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=XAgCk2Aj0EBQWC6lNsaJJy1FnlIlYx98oy4GqXugUsw=; b=K2dYj9yPB2Lvy70bUXKU6yGD0epYlSHBOfQtFo/Q+A8zfQWkh15WS+1eKsAwYtz7v8 B8f5I4DJ0nIMrhBSfU1eOmIxOJxi/taXbv+iTJJkyLtQa/sdI2Fylq2mMxr1RERT6rep Tc9WCtoVIkBYudM/al5GGQGMyXjZDiPru9pCC31O9YbFVyOy7hNdV5+T2jocGdZldNVg 8Q7xD/a9rwbUpNeLYl4wJyUllZx8/+6hex8r0Sykbpmn2JUElrZ6HKGEm7Na32ab0GXs IPeXsRKttLdKWK3uMqWEzZhrjA3ua/JjckpCNxtWogxdG16CijL3B23tIFvpRUXsihat HxtQ== X-Gm-Message-State: AOAM532fyXrNXlIzYN0ovjYv/i2xYolZuWjGYN5TZbrvjocvO1Jc2/Bq v4ltkQdNVrh4g2j9WyxF0W+fuuucBRg= X-Google-Smtp-Source: ABdhPJxvtbZsSqdj/IUfV+3xbG3z2hIR80XDqUCVjJ3wv+aLSOJddZ6DzLcotBHctSXzK3cQ46qH7g== X-Received: by 2002:a63:8f18:: with SMTP id n24mr540732pgd.209.1601919476076; Mon, 05 Oct 2020 10:37:56 -0700 (PDT) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id e1sm534796pfd.198.2020.10.05.10.37.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Oct 2020 10:37:55 -0700 (PDT) From: Moritz Fischer To: linux-fpga@vger.kernel.org Cc: trix@redhat.com, hao.wu@intel.com, michal.simek@xilinx.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, russell.h.weight@intel.com, matthew.gerlach@intel.com, Moritz Fischer Subject: [PATCH v2 10/10] fpga: fpga-mgr: altera-pr-ip: Simplify registration Date: Mon, 5 Oct 2020 10:37:35 -0700 Message-Id: <20201005173735.162408-11-mdf@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201005173735.162408-1-mdf@kernel.org> References: <20201005173735.162408-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. Signed-off-by: Moritz Fischer Reviewed-by: Tom Rix --- Changes from v1: - Removed part that removes unused symbol --- 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);