From patchwork Tue Nov 3 07:14:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moritz Fischer X-Patchwork-Id: 11876067 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 009D6697 for ; Tue, 3 Nov 2020 07:14:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D5EF020870 for ; Tue, 3 Nov 2020 07:14:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604387664; bh=4pGVWLxxQpTZrOTdcMlmyeR5t/13IXS9wFRlyMt8Wzk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=zvxhpOSVd8axikqtRfCmHtMkNdBOvxGcbu2iqNPn53tR8sNSRH6Kz0b0d2LEZmDHV i0gb2aosoB5pUTCeVM+yuCHXKeJOoSUGt4qiE+3+PQ2hhWXA1LdgBdSCXWvz+l4Qv/ IRTafXpCGqTQp0NM2wEnOO/znbrUGhRUMh6RkR2M= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725988AbgKCHOY (ORCPT ); Tue, 3 Nov 2020 02:14:24 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:33922 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725958AbgKCHOY (ORCPT ); Tue, 3 Nov 2020 02:14:24 -0500 Received: by mail-pf1-f194.google.com with SMTP id o129so13409831pfb.1 for ; Mon, 02 Nov 2020 23:14:23 -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=eJ+0zZNh9Dba8YXaEQQNVdHQ2nw8Y0xFd6gyvl7OObuA14IxrwTGI6YGR1TWM49B1l ZjbOfIIO9mEuTirjfcZzRPdK4t4llDWgV1RLFPJ5j40t2PuWdANJkBOLykSbnomBY5ih gWejGg3U5EePEGPXmHjWwTEFB/wBy6fiJ5y/TRQHHtSx5f84GmYBn93QzHg4umuAFIY+ rU93PJvxHFjcJuxOWQBlL9lBy1c5HIf4Gtqi/kX8n+DmOEsDt95u/DMYwTAB0urd85Ou 4sf6GUmfDmWi0fvfZWM9tkqUtwe1ojAcn32QxTGP8bHjkW/BP3+E6I8l+f+iYw/+Etz9 bB9g== X-Gm-Message-State: AOAM532pSgtp5y0ASFn7hE0HLdCW56jbLWK0w7YxF0a2xaZ/QONUfOVu qGMRdkBsomzYaZ6CthIAinQ= X-Google-Smtp-Source: ABdhPJxVp6amYp/mCIBJaAo2EQG7oYiSxcIgLUgPUOSG3eEsTymiOqfg5oZSJgVXc/9wexoxpyaApA== X-Received: by 2002:a62:16ce:0:b029:160:5faa:23d5 with SMTP id 197-20020a6216ce0000b02901605faa23d5mr24885905pfw.26.1604387663449; Mon, 02 Nov 2020 23:14:23 -0800 (PST) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id b67sm15873289pfa.151.2020.11.02.23.14.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 23:14:22 -0800 (PST) From: Moritz Fischer To: gregkh@linuxfoundation.org Cc: linux-fpga@vger.kernel.org, Moritz Fischer , Tom Rix Subject: [PATCH 01/10] fpga: fpga-mgr: Add devm_fpga_mgr_register() API Date: Mon, 2 Nov 2020 23:14:02 -0800 Message-Id: <20201103071411.11997-2-mdf@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103071411.11997-1-mdf@kernel.org> References: <20201103071411.11997-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 Tue Nov 3 07:14:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moritz Fischer X-Patchwork-Id: 11876069 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 03D306A2 for ; Tue, 3 Nov 2020 07:14:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DBD89223EA for ; Tue, 3 Nov 2020 07:14:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604387665; bh=crGQ/tchB8XEN9FALvUBXHbeRk3b6uKCnwKAMhwo10k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=TzAL/PJ6XNfHM6Mxd8gOl7zp0DiCcEI0b6e+Wcef8eVUJ1JMfYmSYLFrlKSQ+W83+ 5JPnjNorUQH8TD5FU6/Z2iDQT3vnS8He0vC6qNjrC+S1sAPkGDsoEEJ3Nb1aDAIeXm 8Qrl+Z1OewfDyLF74tPLm2bhfqSN7mB+jASgeyfQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726659AbgKCHOZ (ORCPT ); Tue, 3 Nov 2020 02:14:25 -0500 Received: from mail-pf1-f170.google.com ([209.85.210.170]:38964 "EHLO mail-pf1-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725958AbgKCHOZ (ORCPT ); Tue, 3 Nov 2020 02:14:25 -0500 Received: by mail-pf1-f170.google.com with SMTP id z3so7017641pfz.6 for ; Mon, 02 Nov 2020 23:14:25 -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=RmxnltR7DkC722NpaLSpz4ZIH4aasHwsH2O+B83hyhuTLhfvUITfaC5lNJwpc15UHP sp9XC6GTRPmg5HELJjuCE+kTDiCkvtHYN4liXexCPEByITn/xlG6BgXZAPxnBTxT8exK 2zHtIbtuG/wkk7326Yx+CjiK3Kr/K27VRURwiSxBGb8a+2cIBF7aWwEZReaURElXly1Y 4AsuQQr+Wk4NJexoFMEAQC2tGDoWOaQk7zFtyNlbK+nTBWH/vz0IJtpOZIqApcGvqnmr 6eLnk2j0mnMmT+JySSm3oGBXubS7UrI5ejL4zLaZzglMFqYVyQUofoM53/WoOKAHF7B1 qKww== X-Gm-Message-State: AOAM533knXjPfZNBfrXiuS16tZO1mCrkf6uD8ONzC/sCOKduPyt6tYFr 5tz/Q8sj2Z2VM9uEL5VpLwQ= X-Google-Smtp-Source: ABdhPJxHxx89qNZjf1QiaPvqa3M4V1iRJl/rNTvNUFX/xot0DMiq9GI30OrmDbVSUWA1TNSzJ6KXvA== X-Received: by 2002:a17:90a:ab87:: with SMTP id n7mr2449893pjq.201.1604387664916; Mon, 02 Nov 2020 23:14:24 -0800 (PST) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id k8sm14224959pgi.39.2020.11.02.23.14.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 23:14:24 -0800 (PST) From: Moritz Fischer To: gregkh@linuxfoundation.org Cc: linux-fpga@vger.kernel.org, Moritz Fischer , Tom Rix Subject: [PATCH 02/10] fpga: fpga-mgr: altera-ps-spi: Simplify registration Date: Mon, 2 Nov 2020 23:14:03 -0800 Message-Id: <20201103071411.11997-3-mdf@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103071411.11997-1-mdf@kernel.org> References: <20201103071411.11997-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 Tue Nov 3 07:14:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moritz Fischer X-Patchwork-Id: 11876071 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 67AFA697 for ; Tue, 3 Nov 2020 07:14:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 47997223EA for ; Tue, 3 Nov 2020 07:14:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604387670; bh=fw+IcMj1Qotp+DTXYmHR9mWFWa4p+6TaRklzywpDGRY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=LYJlTPJc/ypU0GmYvUdqsmJ8sPd2IljDIzZe/5b3NAKj1q2CfAprhsP8EzlQBa6gQ W6ZDmKXj4vHbeLwmOglLUAZoN8oTbWG7BxKwM7esbgqCY24NHcByLjsmzmFti/lEmz 3igMK733u0ikMQ6cVbpswLj3ctC/57IKs+RsKz2s= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727686AbgKCHOa (ORCPT ); Tue, 3 Nov 2020 02:14:30 -0500 Received: from mail-pl1-f176.google.com ([209.85.214.176]:36111 "EHLO mail-pl1-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725958AbgKCHO0 (ORCPT ); Tue, 3 Nov 2020 02:14:26 -0500 Received: by mail-pl1-f176.google.com with SMTP id r10so8154948plx.3 for ; Mon, 02 Nov 2020 23:14:26 -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=b+VSpVyRaCraKrDTSjyUIU+U4TCqoslbtZDCtnL+gTyPMP+sAazwGimjZFjqyPc0+S wOxF3bSDQKSpV0hsFi45yHHbTRzfSun1ElFOAFE1D7P4AE/Bqw5C797wrl5pr7nkELYe /zeIMWam2t6+FVke3LIv9Y+3rMZUrslTt0kFt7q99795XaAV9Dr3DVn99CYPf4URPpy6 XDjEOq1yesdPJ2YrADPaWJGzbAPlX/G5VRTHs30Ykv7IdMLd1lSic3tqMoTZgGDOsNLq sv2zDro/iy0ivs92coRZxAjaRDRVav9Ki6FKL4BWy2X8nfH0gOP/LDGcSXig4uFTuG9r efvg== X-Gm-Message-State: AOAM530oygepmHRiL7NAoNrGGDxh9uWU6rlKh4bHSC/ec8pipbbYdPFk qYA9zHlu5g+tmDr8bpTAejFnTcEWDk8= X-Google-Smtp-Source: ABdhPJw0guC6DdN3oYKa4xtVtz/K44ryL7c6rzsCa2M3Zkh6Hc7+7sN91S1d2Fb/0Yy65AuZ1gYVxQ== X-Received: by 2002:a17:902:8698:b029:d3:b362:7342 with SMTP id g24-20020a1709028698b02900d3b3627342mr24267624plo.50.1604387666257; Mon, 02 Nov 2020 23:14:26 -0800 (PST) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id w19sm11916126pff.76.2020.11.02.23.14.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 23:14:25 -0800 (PST) From: Moritz Fischer To: gregkh@linuxfoundation.org Cc: linux-fpga@vger.kernel.org, Moritz Fischer , Tom Rix Subject: [PATCH 03/10] fpga: fpga-mgr: dfl-fme-mgr: Simplify registration Date: Mon, 2 Nov 2020 23:14:04 -0800 Message-Id: <20201103071411.11997-4-mdf@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103071411.11997-1-mdf@kernel.org> References: <20201103071411.11997-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 Tue Nov 3 07:14:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moritz Fischer X-Patchwork-Id: 11876075 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 C5D0E6A2 for ; Tue, 3 Nov 2020 07:14:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A144620870 for ; Tue, 3 Nov 2020 07:14:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604387670; bh=SnkBpUHO7WBOLykzc5cTC7Pk/4DVRkrL6fxoDooJnww=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=BdLVwFDRk41Ahj6MbnOKd4uwZoyEmCGXKT75QhkAQKQOckZIbeYg/V5RB+TFQBldZ chFM5d72tlds4xFKSmJTWXQcllJ4NNF6l6s1VmQSsNd5LqLUn1/zjRg6b8qY/2su8j qZF+HAEJ37X8n/TJWVDfiwsQlFOv1dKTGjplGFLA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727567AbgKCHOa (ORCPT ); Tue, 3 Nov 2020 02:14:30 -0500 Received: from mail-pf1-f181.google.com ([209.85.210.181]:38978 "EHLO mail-pf1-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727527AbgKCHO2 (ORCPT ); Tue, 3 Nov 2020 02:14:28 -0500 Received: by mail-pf1-f181.google.com with SMTP id z3so7017736pfz.6 for ; Mon, 02 Nov 2020 23:14:28 -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=KsSUO8iZCduquENr5WKjLtsyi89cXx1YZQzHqcxKy4rUum1Hj5RL+jrhanjXR+h0qe hZGP4DS4cp8ikz4wpvvcVYI5nGhuRs+TPxld++udsVYvMA6mU0nIamnRBadctpXgXdRI Yz44FyZTN93TvXmPGlSeabAPVbM0JY9J8pQp2XtIIzlzUgiaGQvzQvTgNYyHjxpyHTHP dnpHe0sS9rmJ4dH+hMX0k8HyDqkTlRIx2kjIV8b9gOfFkCokOE62kb79t/iVKjVC4mE5 lCdZrpFWSYvRg011q0IAPbvTxsD5izBoueHg78MQVN54iEuGt0Igjz1oEyHVHAm0Jeux lODQ== X-Gm-Message-State: AOAM530PWe164jS2VI035D5Fhp2kns+VzNsoIytDx4Iv2+WCO+VIPY4U irXmvU7Nt03X0PA989dorrg= X-Google-Smtp-Source: ABdhPJwm99N8HGhZDokL/tUHJm9Y21+kAzO42BCzBiOnWEe2KCW7MgfDt9TKtbsy8Q8nXNa9F6zKlw== X-Received: by 2002:a17:90b:4749:: with SMTP id ka9mr2386054pjb.197.1604387667680; Mon, 02 Nov 2020 23:14:27 -0800 (PST) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id nv7sm1843604pjb.27.2020.11.02.23.14.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 23:14:27 -0800 (PST) From: Moritz Fischer To: gregkh@linuxfoundation.org Cc: linux-fpga@vger.kernel.org, Moritz Fischer , Tom Rix Subject: [PATCH 04/10] fpga: fpga-mgr: ice40-spi: Simplify registration Date: Mon, 2 Nov 2020 23:14:05 -0800 Message-Id: <20201103071411.11997-5-mdf@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103071411.11997-1-mdf@kernel.org> References: <20201103071411.11997-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 Tue Nov 3 07:14:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moritz Fischer X-Patchwork-Id: 11876073 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 94F1D14B2 for ; Tue, 3 Nov 2020 07:14:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7A6F0223AC for ; Tue, 3 Nov 2020 07:14:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604387670; bh=j4vFZkmtcnbkVUy9vaomZ3ZaEX2fPnLVmIGDJLBJclw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=gqz+UOPAj9+vQRT19StOgf1QQUKuT6xlj6AneHwuYW3CNn+8vl2ScIrpALTgme24r PxDnxcx//m+HjPl8sT3YrQHBSV14GINtQYqk2AfUOWp3vp2Hi0mLWPanKKSKjmK6pN e+YFko9w2z0S8ExQR2gnBpZu85cAxtzkeTPCtTAM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725958AbgKCHOa (ORCPT ); Tue, 3 Nov 2020 02:14:30 -0500 Received: from mail-pf1-f174.google.com ([209.85.210.174]:38973 "EHLO mail-pf1-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727567AbgKCHO3 (ORCPT ); Tue, 3 Nov 2020 02:14:29 -0500 Received: by mail-pf1-f174.google.com with SMTP id z3so7017775pfz.6 for ; Mon, 02 Nov 2020 23:14:29 -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=J3hxQX0bdMZ/vBQW9P8/bO5JgMXDJi5zVu0VVMeuZUBKF9i3Itfi8t+WfajY8ghEJ5 YeqSZeFSHPz66Db5mB3UzV0Poxq67S5nfKN897FWFQUfMRL5y0SgS/7SIHem5qdbCM+/ mcB6zqMgkOkAYw1O3oG1S4/7ByOsNfzwCIXo8LODS4aTBnx/2JPg7hJZzmpweA5U8GvI NBtaHwL+OI9GQnPa/AWKLEYl2GJ7Ya8NweSfSe8PdZcaTiKgovxgRKVW1XJCMJdIURHW fnle2r9Pf5PGIF4arqckQQrYI5sHCim3/Z4Ykp2pvDZEwIKOIDPSrRiku49auwOeJIVK VD8Q== X-Gm-Message-State: AOAM530w7n6Ajq8hSG3rEdCfXTBPT/vrIxOaXb1veeVZI3evIMUDxR7E BB1JS+Ft6lyb3wzdlbcn8Mc= X-Google-Smtp-Source: ABdhPJzHTwEIZTEMLLhykXqoVtSeCQFOsM9uyl0oTdY3nwWjUqwsWMTYLGnbG1DwX1uXBgotKUe3yA== X-Received: by 2002:a17:90b:385:: with SMTP id ga5mr2413186pjb.13.1604387669050; Mon, 02 Nov 2020 23:14:29 -0800 (PST) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id v4sm14799001pfm.57.2020.11.02.23.14.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 23:14:28 -0800 (PST) From: Moritz Fischer To: gregkh@linuxfoundation.org Cc: linux-fpga@vger.kernel.org, Moritz Fischer , Tom Rix Subject: [PATCH 05/10] fpga: fpga-mgr: machxo2-spi: Simplify registration Date: Mon, 2 Nov 2020 23:14:06 -0800 Message-Id: <20201103071411.11997-6-mdf@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103071411.11997-1-mdf@kernel.org> References: <20201103071411.11997-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 Tue Nov 3 07:14:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moritz Fischer X-Patchwork-Id: 11876077 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 868E514B2 for ; Tue, 3 Nov 2020 07:14:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5E7C5223FD for ; Tue, 3 Nov 2020 07:14:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604387671; bh=4Ru+QowTNI5n9EyiWvVm9qHGzEmUFAfs2+CTKWAEfrc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=0L/zmxXC8GtCeoFEXOGdWzdDLh+UTfocLR4UmH1ju1wOzoStumILT3Ni5ajpn8DAR NDlco2WAJxGt8yjmTcuaBaBICv8FQPvLjoB3BvSv9eC691vmZNAB/nPkEE+zovJjRO jEPdePnQtMeBEzou4dnQ5pVgZcqgu1WkJMZjPHVg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727687AbgKCHOb (ORCPT ); Tue, 3 Nov 2020 02:14:31 -0500 Received: from mail-pl1-f179.google.com ([209.85.214.179]:42229 "EHLO mail-pl1-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727527AbgKCHOa (ORCPT ); Tue, 3 Nov 2020 02:14:30 -0500 Received: by mail-pl1-f179.google.com with SMTP id t22so8135480plr.9 for ; Mon, 02 Nov 2020 23:14:30 -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=SQeNiWasIalMypOVAgNa5g9gMIXDmdUyKiT3fMITm6pOK5my7h94O7umNgHaoNoOlS Ul9F5XYbXj1LuccEHE4j8j4zLZgFO36lrPUeLdDWfJ/1QbAdorGrOQ2pT1Vo3/nqw0K8 2J6mgoW+90NJsC1wEnjal6jl75XCbI9DrtuZsC+eahQLLf3/KIa1AqzfWyQEVy5h4eLj RnLdaj5DKERt0xKgDYBixeOXv/InhtKBtY4wCivwUtjm9XwBGPExcuLFdnN71uxvZiNx uohrlyfvDyyOhUINcvt1LpBrfSQr42wFjl87jVsC8C9hSj7TamIjH3kYM8caI+IIt2Ek UMNQ== X-Gm-Message-State: AOAM530Gei+AnT07zZbW0a+7XX7lk7/8t9im01tBbYF7keluBg7XvkKo 2sDV5dv94AeCpg3hwf0+mN8= X-Google-Smtp-Source: ABdhPJykxjPoU6L1KYLXVWZ28dIFxDV6RI1rd7OSpbTfYHcj68tGywvsSUaAqx69Vy2/1S0gC19k7w== X-Received: by 2002:a17:902:aa8a:b029:d3:c9dd:77d1 with SMTP id d10-20020a170902aa8ab02900d3c9dd77d1mr24490295plr.0.1604387670447; Mon, 02 Nov 2020 23:14:30 -0800 (PST) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id 126sm4318561pfw.10.2020.11.02.23.14.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 23:14:30 -0800 (PST) From: Moritz Fischer To: gregkh@linuxfoundation.org Cc: linux-fpga@vger.kernel.org, Moritz Fischer , Tom Rix Subject: [PATCH 06/10] fpga: fpga-mgr: socfpga: Simplify registration Date: Mon, 2 Nov 2020 23:14:07 -0800 Message-Id: <20201103071411.11997-7-mdf@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103071411.11997-1-mdf@kernel.org> References: <20201103071411.11997-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 Tue Nov 3 07:14:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moritz Fischer X-Patchwork-Id: 11876079 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 419D26A2 for ; Tue, 3 Nov 2020 07:14:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 23970223C7 for ; Tue, 3 Nov 2020 07:14:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604387673; bh=xk9dFqT1vXaEljZxblG/fHEfQ0rsm0unBQYgWWnbhWQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=WqXpbE0XIh9SLR4Y19x/OeIr+DDrz6XgaA/iFPq4On58Cm2jFTzck6NKyYwU6LCUe +vFjSOscKw9lMzjWCxTgQNkz4X45AF+kPa7NSuQqFNb6J8ze+Se9A8HE7axZveiUr5 Eu9Jld2mQ81s88AAgh6Q2SRIB1rXs1NVFJa0zc48= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727696AbgKCHOc (ORCPT ); Tue, 3 Nov 2020 02:14:32 -0500 Received: from mail-pg1-f179.google.com ([209.85.215.179]:36110 "EHLO mail-pg1-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727527AbgKCHOc (ORCPT ); Tue, 3 Nov 2020 02:14:32 -0500 Received: by mail-pg1-f179.google.com with SMTP id z24so12987331pgk.3 for ; Mon, 02 Nov 2020 23:14: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=9kkAXw7Tt0cYJ71J1z6lzt/Cc75SkXOHsBVdYO06bFQ=; b=eTvNnj3lUvoojT8SJ2dr1uikTM5VnAEXJAJZ1Cyj6veC+b1i2OzS8E8dLGmUHLIZoE hh/yd6htr3RTozGIRMBNpl9r0C1J9Bm2eRyUETGupsSg7yh2vCDbyOkWZOLtQwY7qISO +myFS+OzdfPHp8ZKp4URg0xVWgCDIQjrJoKtzNGkmKIXBvpueZ4e3UYhZdeshFAF+Wl0 onsBHrlrkbMIaEJJssVx67N5aJc1nmhESsDpBxnjbTNTX2DcTtqSgNY/YBTrrvpCXVn8 ytfz0C4C31X4ikKyi0+W5cQAS8PjUbS9ahsEXInL+Jb0sAyuwLCbQfhXRP/5J2aeS6sx YNxQ== X-Gm-Message-State: AOAM533kYIc3kS0mxHZjey7TekXRVowsH8lqFnwajKaajOR4+ssbGdEu tRsKUV7UGfQ953JxD92TKbI= X-Google-Smtp-Source: ABdhPJz2FfIJOaCkrBqXjMg6fUEne1HyamOPAy0CdZ6TcxWCzw+9DTXp5GqdM6FwROB60fI+bMKotQ== X-Received: by 2002:aa7:85c3:0:b029:156:78e8:1455 with SMTP id z3-20020aa785c30000b029015678e81455mr24592291pfn.68.1604387671880; Mon, 02 Nov 2020 23:14:31 -0800 (PST) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id f17sm16018030pfq.141.2020.11.02.23.14.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 23:14:31 -0800 (PST) From: Moritz Fischer To: gregkh@linuxfoundation.org Cc: linux-fpga@vger.kernel.org, Moritz Fischer , Tom Rix Subject: [PATCH 07/10] fpga: fpga-mgr: ts73xx: Simplify registration Date: Mon, 2 Nov 2020 23:14:08 -0800 Message-Id: <20201103071411.11997-8-mdf@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103071411.11997-1-mdf@kernel.org> References: <20201103071411.11997-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 Tue Nov 3 07:14:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moritz Fischer X-Patchwork-Id: 11876081 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 F316D697 for ; Tue, 3 Nov 2020 07:14:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D77AE223EA for ; Tue, 3 Nov 2020 07:14:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604387675; bh=TjF3ugVLeBEBLNxCGYps11K6MeFpjO4xMFUFwqL66Tw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=aGVSMWibTRJ5Gj0kF1KE1e+J+kd2NKeK5vicMjtNV9SmDsgen63pUNj6ytfneULz0 B+P+jyK/wUngEssx9RhrDh+HVlLR+p6F7ZVVGNPQzxU0D4H8LfbdcFCS9L/OJNxx+j pHqOwW5XAaTTlIlT7UbY8zBdH63KncZvgKUynGKE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727742AbgKCHOf (ORCPT ); Tue, 3 Nov 2020 02:14:35 -0500 Received: from mail-pl1-f180.google.com ([209.85.214.180]:33954 "EHLO mail-pl1-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727527AbgKCHOf (ORCPT ); Tue, 3 Nov 2020 02:14:35 -0500 Received: by mail-pl1-f180.google.com with SMTP id p4so819168plr.1 for ; Mon, 02 Nov 2020 23:14:33 -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=E2vsxC7gfE2S4KUwbagLwgpOfbovbTJBwxGziqsJe3IuE+rQ5GhHJFcOaI312OBzbl 8v/USCm/q3qpB3y86t6ty5wpP534xx5CbWnfb54E4CgG1+MzOj1Bvpos/h0NEalvvqqa 24wwLfyC9MF7FuaCRHrSYBJIcN7ew85Hr+RdKcqPmExnBpeDYrMJy4HZj4TID6POmUa0 kmjW3+LtZHX9VtaMReRdBhP4a4D6Rwqz04oOQYxMKZHOBgRtQ0nre5nYFtM4XR+SJP/6 ajqmd+5u2ZSlA9vHy+EdtA+VTfJB2XQN6aYeKti18IWW7DxaFSeGvGj3LEjQKhOLdYBx tS2Q== X-Gm-Message-State: AOAM530/cO9Li2+lir8+uB0MZgV1Y/SXG9/UADKhVlWlGNzqP7Z62lTR JrnyBz4G13dWoKESw9kDXZs= X-Google-Smtp-Source: ABdhPJy+u+HLt80DhRGhv3Ri+/OZgoItuF38vTSHCLAzybcVHis4TqP7gLaN9LtATCGiCkkGzq3Chg== X-Received: by 2002:a17:902:e788:b029:d6:dc69:80a8 with SMTP id cp8-20020a170902e788b02900d6dc6980a8mr4169620plb.59.1604387673305; Mon, 02 Nov 2020 23:14:33 -0800 (PST) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id g1sm1289387pjl.33.2020.11.02.23.14.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 23:14:32 -0800 (PST) From: Moritz Fischer To: gregkh@linuxfoundation.org Cc: linux-fpga@vger.kernel.org, Moritz Fischer , Tom Rix Subject: [PATCH 08/10] fpga: fpga-mgr: xilinx-spi: Simplify registration Date: Mon, 2 Nov 2020 23:14:09 -0800 Message-Id: <20201103071411.11997-9-mdf@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103071411.11997-1-mdf@kernel.org> References: <20201103071411.11997-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 Tue Nov 3 07:14:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moritz Fischer X-Patchwork-Id: 11876083 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 33C5614B2 for ; Tue, 3 Nov 2020 07:14:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0E06B223EA for ; Tue, 3 Nov 2020 07:14:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604387676; bh=KKwFkF9m+4G/z8gklXDbV6fU9QNx/tabEZ1MhOdmV9U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=TQXcmTCBfN2aiSTJlXUqzefGwJxHpe0U/go352dTvOy7atuygmwpra11hEHU+xc9g 5JV5q1rJ7S4Ph5O5vEFkWZUuV7+r2Q6JklvAKRfUJ/xj6S81OtpGZ/n2EuQNKb/Mjv IiJ6g60VR+RVvtiJ8FAu5hLiWgrmytHdJZicthBY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727527AbgKCHOf (ORCPT ); Tue, 3 Nov 2020 02:14:35 -0500 Received: from mail-pl1-f172.google.com ([209.85.214.172]:41880 "EHLO mail-pl1-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727529AbgKCHOf (ORCPT ); Tue, 3 Nov 2020 02:14:35 -0500 Received: by mail-pl1-f172.google.com with SMTP id w11so8138723pll.8 for ; Mon, 02 Nov 2020 23:14: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=mxJeDzUo1JlM94sM/0JUoVzyH5QVj44C4f1rGzo7Qbs=; b=PwgkGPQJpVWJDFzv6bCLqKww5hkwgaezS7kdZHrvK4W7t9uUnfu1cM5LRddg576y1n CRfjFXj2dcE+iDD/K48cB0SRcgn+f7lPXjOw4FcFfq60TDth6Z4VeBRDujWW+zRLKhQ8 J7STnLcrBk84Sudoa9ze591xhLaMe3kjEqncTWM+Zp5Amg7Wj0h1OS62soTvg61gyiLV LVZ3qspdDiQ4YVB7+4mlnYedyqGOGPJb5nL+e0iPKBooc5VEzfKLd4hUv8NDr2Iqq5Uv MBeYUSo19be/p1UtI1qGeREOjzsS6x3JBGNy1xo1DkaGDJ4FqhXkNeKc3kPUX+sZWdq5 LrUg== X-Gm-Message-State: AOAM530RPeUSDB34ps1gih/9b2BraCH3ErmotZna7UtAy3vpL/ScwfgU dFd5ymvC34ojSgApziIlafbTBjOF7Z4= X-Google-Smtp-Source: ABdhPJxSvboeFN2NYiFP+B7/TwhlhxlkHzn7Tx+Zjer5UzyHMgBwIlAUx9kgDSN3QaxUs8bj2fTtWQ== X-Received: by 2002:a17:902:7408:b029:d6:8208:bc7 with SMTP id g8-20020a1709027408b02900d682080bc7mr24187987pll.82.1604387674880; Mon, 02 Nov 2020 23:14:34 -0800 (PST) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id t15sm3470850pjq.3.2020.11.02.23.14.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 23:14:34 -0800 (PST) From: Moritz Fischer To: gregkh@linuxfoundation.org Cc: linux-fpga@vger.kernel.org, Moritz Fischer , Tom Rix Subject: [PATCH 09/10] fpga: fpga-mgr: zynqmp: Simplify registration Date: Mon, 2 Nov 2020 23:14:10 -0800 Message-Id: <20201103071411.11997-10-mdf@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103071411.11997-1-mdf@kernel.org> References: <20201103071411.11997-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 Tue Nov 3 07:14:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moritz Fischer X-Patchwork-Id: 11876085 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 9BA056A2 for ; Tue, 3 Nov 2020 07:14:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7C1B2223C7 for ; Tue, 3 Nov 2020 07:14:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604387677; bh=nRa4zuttkYIZdzZQuSNvRxh5tnFTI9UL4ZHdkyQwzN4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=EFYAlVUpkrlfDzXSoILizej8SltojRuh9EdtOYzDD57PJ8OLJmNiV5/wONRq28Yf6 Gzky064ZvFwbgJwwqp4s1ZUnzgyEoOxzX8Nqe+AyteTsxqus7t9Dd+FLmUIpkSzqUo x5GPA4ij7yO7Vul9ouuV6kUsyAMML2NMoipakDns= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727760AbgKCHOh (ORCPT ); Tue, 3 Nov 2020 02:14:37 -0500 Received: from mail-pg1-f177.google.com ([209.85.215.177]:40514 "EHLO mail-pg1-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727529AbgKCHOh (ORCPT ); Tue, 3 Nov 2020 02:14:37 -0500 Received: by mail-pg1-f177.google.com with SMTP id x13so12960582pgp.7 for ; Mon, 02 Nov 2020 23:14: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=eHdU5oxW9fYEoWkH8yF79mOZPyoTqXNwEc+aAMEPYfM=; b=mxK7+daf0HGd825gB65hG5PxI5QVj6kd18obnNPqpV7jvGlVelz4eSF/Jxdkl6fJHg 4l0FsT8hArYQA/jXeD9l5REfok2DG/GlR7BmklgGac3kz8kkpoB8z6s9m7WYoYZhaknv gc8/5t20rN8OKpw2zu58xnH5+F82PVcYWPnXP26670HCcnMQ1sbwgPEUzf3z3vxcRY2l 2crnHlF9aaWJv2W+mffsAdo4IyJVq+Rxlii3gQaFW+aSvPst0RkJk3fVZQrM0llj1rnu IS3NUWmJfio1FKBYiHeIoihUV9mT1dLYNnGY//JL2siB1o1SbWwOwDFXCQ38Fmk1QRsg 1bdA== X-Gm-Message-State: AOAM5300+KF86MIQ6Mn8wH2S7qZIgln/kcVn+WX6Fzl52yp9SYVFlxxG gpNQ2NjXx6eobXLN95auDJH3HWPSP6g= X-Google-Smtp-Source: ABdhPJwb7dpptOBSVF/bK+fYAVjOkr6Zynbu/kVPtngdaew2R8ObpKBBPWsnGsaSfkMDvwlQ7isgeA== X-Received: by 2002:a63:4383:: with SMTP id q125mr16327992pga.30.1604387676300; Mon, 02 Nov 2020 23:14:36 -0800 (PST) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id e9sm5269333pgi.5.2020.11.02.23.14.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 23:14:35 -0800 (PST) From: Moritz Fischer To: gregkh@linuxfoundation.org Cc: linux-fpga@vger.kernel.org, Moritz Fischer , Tom Rix Subject: [PATCH 10/10] fpga: fpga-mgr: altera-pr-ip: Simplify registration Date: Mon, 2 Nov 2020 23:14:11 -0800 Message-Id: <20201103071411.11997-11-mdf@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103071411.11997-1-mdf@kernel.org> References: <20201103071411.11997-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);