From: Moritz Fischer <mdf@kernel.org> To: Wu Hao <hao.wu@intel.com> Cc: gregkh@linuxfoundation.org, mdf@kernel.org, linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, linux-doc@vger.kernel.org, atull@kernel.org Subject: Re: [PATCH v5 1/9] fpga: dfl: make init callback optional Date: Tue, 20 Aug 2019 20:24:06 -0700 [thread overview] Message-ID: <20190821032406.GA28625@archbox> (raw) In-Reply-To: <1565578204-13969-2-git-send-email-hao.wu@intel.com> Hi, On Mon, Aug 12, 2019 at 10:49:56AM +0800, Wu Hao wrote: > This patch makes init callback of sub features optional. With > this change, people don't need to prepare any empty init callback. > > Signed-off-by: Wu Hao <hao.wu@intel.com> Acked-by: Moritz Fischer <mdf@kernel.org> > --- > drivers/fpga/dfl.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/drivers/fpga/dfl.c b/drivers/fpga/dfl.c > index c0512af..96a2b82 100644 > --- a/drivers/fpga/dfl.c > +++ b/drivers/fpga/dfl.c > @@ -271,11 +271,13 @@ static int dfl_feature_instance_init(struct platform_device *pdev, > struct dfl_feature *feature, > struct dfl_feature_driver *drv) > { > - int ret; > + int ret = 0; > > - ret = drv->ops->init(pdev, feature); > - if (ret) > - return ret; > + if (drv->ops->init) { > + ret = drv->ops->init(pdev, feature); > + if (ret) > + return ret; > + } > > feature->ops = drv->ops; You could swap it around maybe like so: int dfl_feature_instance_init() ... { feature->ops = drv->ops; if (drv->ops->init) return drv->ops->init(pdev, feature); return 0; } With the caveat that feature->ops gets always set ... Your call. Thanks, Moritz
WARNING: multiple messages have this Message-ID (diff)
From: Moritz Fischer <mdf@kernel.org> To: Wu Hao <hao.wu@intel.com> Cc: gregkh@linuxfoundation.org, mdf@kernel.org, linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, linux-doc@vger.kernel.org, atull@kernel.org Subject: Re: [PATCH v5 1/9] fpga: dfl: make init callback optional Date: Tue, 20 Aug 2019 20:24:08 -0700 [thread overview] Message-ID: <20190821032406.GA28625@archbox> (raw) In-Reply-To: <1565578204-13969-2-git-send-email-hao.wu@intel.com> Hi, On Mon, Aug 12, 2019 at 10:49:56AM +0800, Wu Hao wrote: > This patch makes init callback of sub features optional. With > this change, people don't need to prepare any empty init callback. > > Signed-off-by: Wu Hao <hao.wu@intel.com> Acked-by: Moritz Fischer <mdf@kernel.org> > --- > drivers/fpga/dfl.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/drivers/fpga/dfl.c b/drivers/fpga/dfl.c > index c0512af..96a2b82 100644 > --- a/drivers/fpga/dfl.c > +++ b/drivers/fpga/dfl.c > @@ -271,11 +271,13 @@ static int dfl_feature_instance_init(struct platform_device *pdev, > struct dfl_feature *feature, > struct dfl_feature_driver *drv) > { > - int ret; > + int ret = 0; > > - ret = drv->ops->init(pdev, feature); > - if (ret) > - return ret; > + if (drv->ops->init) { > + ret = drv->ops->init(pdev, feature); > + if (ret) > + return ret; > + } > > feature->ops = drv->ops; You could swap it around maybe like so: int dfl_feature_instance_init() ... { feature->ops = drv->ops; if (drv->ops->init) return drv->ops->init(pdev, feature); return 0; } With the caveat that feature->ops gets always set ... Your call. Thanks, Moritz
next prev parent reply other threads:[~2019-08-21 3:24 UTC|newest] Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-08-12 2:49 [PATCH v5 0/9] FPGA DFL updates Wu Hao 2019-08-12 2:49 ` [PATCH v5 1/9] fpga: dfl: make init callback optional Wu Hao 2019-08-21 3:24 ` Moritz Fischer [this message] 2019-08-21 3:24 ` Moritz Fischer 2019-08-21 5:12 ` Wu Hao 2019-08-12 2:49 ` [PATCH v5 2/9] fpga: dfl: fme: convert platform_driver to use dev_groups Wu Hao 2019-08-21 3:28 ` Moritz Fischer 2019-08-21 3:28 ` Moritz Fischer 2019-08-12 2:49 ` [PATCH v5 3/9] fpga: dfl: afu: " Wu Hao 2019-08-22 15:07 ` Moritz Fischer 2019-08-22 15:07 ` Moritz Fischer 2019-08-27 21:38 ` Wu Hao 2019-08-12 2:49 ` [PATCH v5 4/9] fpga: dfl: afu: add userclock sysfs interfaces Wu Hao 2019-08-12 2:50 ` [PATCH v5 5/9] fpga: dfl: afu: expose __afu_port_enable/disable function Wu Hao 2019-08-12 2:50 ` [PATCH v5 6/9] fpga: dfl: afu: add error reporting support Wu Hao 2019-08-12 2:50 ` [PATCH v5 7/9] fpga: dfl: afu: add STP (SignalTap) support Wu Hao 2019-08-12 2:50 ` [PATCH v5 8/9] fpga: dfl: fme: add global error reporting support Wu Hao 2019-08-12 2:50 ` [PATCH v5 9/9] Documentation: fpga: dfl: add descriptions for virtualization and new interfaces Wu Hao 2019-08-19 5:31 ` [PATCH v5 0/9] FPGA DFL updates Wu Hao 2019-08-19 20:51 ` Greg KH 2019-08-20 3:14 ` Wu Hao
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20190821032406.GA28625@archbox \ --to=mdf@kernel.org \ --cc=atull@kernel.org \ --cc=gregkh@linuxfoundation.org \ --cc=hao.wu@intel.com \ --cc=linux-api@vger.kernel.org \ --cc=linux-doc@vger.kernel.org \ --cc=linux-fpga@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.