Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1448015yba; Tue, 2 Apr 2019 09:03:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqzhOmX6P+F1BV1gmXGW0YO1hy7lNFOLxWwrKGqTcZx5DwbGJCYz7OgcjRWC3/TPwUB4FpM9 X-Received: by 2002:a62:482:: with SMTP id 124mr66483985pfe.191.1554221026428; Tue, 02 Apr 2019 09:03:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554221026; cv=none; d=google.com; s=arc-20160816; b=ukQJnunUWLnAm3pIwcHaL/cjUv9A24ybG+Xw8dF797ob1T4fGRE9iiM3V2ZXZLYCCI nhJ9L/jSVXXa3v9SM42ukJ5Kk+yIK+TeDAXwMzimVtkD2V21zVCZ9cZKXak6oTnj/yEJ hgDzraJJrwQw5gs7To9nVL9Y7Y0HYyJSbzrDyN9qlU4YbddFqHpVMn+o4Hg5PLVJYBEl KZqe/ViW2+ZnK8IWs09WwqM0E9N7iD1y2fnIQ2wz5Zp+SzZMKd8z1/AgEh193NsLTaWD oawX7L8UGlasKy1NhCFWqcAyELAzm3eIpVddNvYM4IF1TI2LWYMMdF75uVqtigbCRNk7 r7fQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Vr7Xurvr8ZOIpnzirFsanXxgCrh1Xd6RlJrJHylNDj4=; b=liKVIz7Q0HhgN5qf1OBdM2HYdMjN2GgsmeBzzfovzlOFZOwpmIvRvQs0vQPDfYmLN2 7yBWk/90gD/YwudBv/LmIr12hrLHygI1RrxLh+OWCHtkVWZu6FsfbjH2BmswDWnobBFh pvds49YxxBbb9kQVXoVArx9IbnSn7+JzvREN2/QNA1sSXqSBcvIzqAp+ecGZlZDZTS60 OAj7lKLwQeReHnrxa8Dgl4nd1VnKv5yCZwXXRX+askBBntLszFU8CVjkDiuCwvKg7w8i ACSTIIgklPjr4ZuNi27xznSK9fzvs029k0tS6uRgypEcNF9g7mEItjc8lgTwKbBKjnaY jAHA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e1si11324507plt.79.2019.04.02.09.03.30; Tue, 02 Apr 2019 09:03:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729600AbfDBPuV (ORCPT + 99 others); Tue, 2 Apr 2019 11:50:21 -0400 Received: from mail-oi1-f196.google.com ([209.85.167.196]:35775 "EHLO mail-oi1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728448AbfDBPuV (ORCPT ); Tue, 2 Apr 2019 11:50:21 -0400 Received: by mail-oi1-f196.google.com with SMTP id j132so10904398oib.2; Tue, 02 Apr 2019 08:50:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Vr7Xurvr8ZOIpnzirFsanXxgCrh1Xd6RlJrJHylNDj4=; b=efRZqcYPOsYwj5oB6uWrr0tTMWLYMbxdAX5JadC49q6tnTIeW6Voq62qVzJc0Rb2E9 TKYNXxj7rI7261KcbX+8/sYNKpnsK1e0kuenkeTzkoHOO1IfunszSrB6OSelwiyeRK6j MDj7qhXktB7Lr0yYGvacXPPkEIfowt5kY+42M/txUIh1TavoBdUlw8x+6hmC6Hv+3ltb qmOAsXz3phyORB61AE2+qSmmXThsdqwVf9kkW9DxOMnkEJRkHYBcf7fWwWrh6MhTzIh9 7UtfYXS+r6ioJzeNyCiykoq1tJLLjA1GsW00KXYzDHBvaZ2+/29HhF6+lGFpl5cN3BVg iCDQ== X-Gm-Message-State: APjAAAUzJv0ii9YRCgPr+SE8zRDoI/8M4f+m88yTH9n369g9YM7s6/r7 bI5amDDezWaoUXBgjQtNNbQ= X-Received: by 2002:aca:e8c4:: with SMTP id f187mr8270335oih.158.1554220219982; Tue, 02 Apr 2019 08:50:19 -0700 (PDT) Received: from localhost ([130.164.62.212]) by smtp.gmail.com with ESMTPSA id g21sm5807120otk.12.2019.04.02.08.50.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Apr 2019 08:50:19 -0700 (PDT) Date: Tue, 2 Apr 2019 08:50:18 -0700 From: Moritz Fischer To: Wu Hao Cc: atull@kernel.org, mdf@kernel.org, linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, Xu Yilun Subject: Re: [PATCH 10/17] fpga: dfl: afu: export __port_enable/disable function. Message-ID: <20190402155018.GA1453@archbook> References: <1553483264-5379-1-git-send-email-hao.wu@intel.com> <1553483264-5379-11-git-send-email-hao.wu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1553483264-5379-11-git-send-email-hao.wu@intel.com> User-Agent: Mutt/1.11.4 (2019-03-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 25, 2019 at 11:07:37AM +0800, Wu Hao wrote: > As these two functions are used by other private features. e.g. > in error reporting private feature, it requires to check port status > and reset port for error clearing. > > Signed-off-by: Xu Yilun > Signed-off-by: Wu Hao Acked-by: Moritz Fischer > --- > drivers/fpga/dfl-afu-main.c | 25 ++++++++++++++----------- > drivers/fpga/dfl-afu.h | 3 +++ > 2 files changed, 17 insertions(+), 11 deletions(-) > > diff --git a/drivers/fpga/dfl-afu-main.c b/drivers/fpga/dfl-afu-main.c > index 2916876..e727d9b 100644 > --- a/drivers/fpga/dfl-afu-main.c > +++ b/drivers/fpga/dfl-afu-main.c > @@ -24,14 +24,16 @@ > #define DRV_VERSION "0.8" > > /** > - * port_enable - enable a port > + * __port_enable - enable a port > * @pdev: port platform device. > * > * Enable Port by clear the port soft reset bit, which is set by default. > * The AFU is unable to respond to any MMIO access while in reset. > - * port_enable function should only be used after port_disable function. > + * __port_enable function should only be used after __port_disable function. > + * > + * The caller needs to hold lock for protection. > */ > -static void port_enable(struct platform_device *pdev) > +void __port_enable(struct platform_device *pdev) > { > struct dfl_feature_platform_data *pdata = dev_get_platdata(&pdev->dev); > void __iomem *base; > @@ -54,13 +56,14 @@ static void port_enable(struct platform_device *pdev) > #define RST_POLL_TIMEOUT 1000 /* us */ > > /** > - * port_disable - disable a port > + * __port_disable - disable a port > * @pdev: port platform device. > * > - * Disable Port by setting the port soft reset bit, it puts the port into > - * reset. > + * Disable Port by setting the port soft reset bit, it puts the port into reset. > + * > + * The caller needs to hold lock for protection. > */ > -static int port_disable(struct platform_device *pdev) > +int __port_disable(struct platform_device *pdev) > { > struct dfl_feature_platform_data *pdata = dev_get_platdata(&pdev->dev); > void __iomem *base; > @@ -106,9 +109,9 @@ static int __port_reset(struct platform_device *pdev) > { > int ret; > > - ret = port_disable(pdev); > + ret = __port_disable(pdev); > if (!ret) > - port_enable(pdev); > + __port_enable(pdev); > > return ret; > } > @@ -810,9 +813,9 @@ static int port_enable_set(struct platform_device *pdev, bool enable) > > mutex_lock(&pdata->lock); > if (enable) > - port_enable(pdev); > + __port_enable(pdev); > else > - ret = port_disable(pdev); > + ret = __port_disable(pdev); > mutex_unlock(&pdata->lock); > > return ret; > diff --git a/drivers/fpga/dfl-afu.h b/drivers/fpga/dfl-afu.h > index 0c7630a..35e60c5 100644 > --- a/drivers/fpga/dfl-afu.h > +++ b/drivers/fpga/dfl-afu.h > @@ -79,6 +79,9 @@ struct dfl_afu { > struct dfl_feature_platform_data *pdata; > }; > > +void __port_enable(struct platform_device *pdev); > +int __port_disable(struct platform_device *pdev); > + > void afu_mmio_region_init(struct dfl_feature_platform_data *pdata); > int afu_mmio_region_add(struct dfl_feature_platform_data *pdata, > u32 region_index, u64 region_size, u64 phys, u32 flags); > -- > 2.7.4 >