From: "Colberg, Peter" <peter.colberg@intel.com>
To: "yilun.xu@linux.intel.com" <yilun.xu@linux.intel.com>
Cc: "Xu, Yilun" <yilun.xu@intel.com>,
"linux-fpga@vger.kernel.org" <linux-fpga@vger.kernel.org>,
"mdf@kernel.org" <mdf@kernel.org>, "Wu, Hao" <hao.wu@intel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"russ.weight@linux.dev" <russ.weight@linux.dev>,
"Pagani, Marco" <marpagan@redhat.com>,
"trix@redhat.com" <trix@redhat.com>,
"matthew.gerlach@linux.intel.com"
<matthew.gerlach@linux.intel.com>
Subject: Re: [PATCH v3 2/9] fpga: dfl: omit unneeded null pointer check from {afu,fme}_open()
Date: Fri, 25 Oct 2024 22:40:57 +0000 [thread overview]
Message-ID: <bb513adfecd4806f73b03ff25a23e80bc69f075d.camel@intel.com> (raw)
In-Reply-To: <ZvJfLplAyNTrPz+E@yilunxu-OptiPlex-7050>
On Tue, 2024-09-24 at 14:41 +0800, Xu Yilun wrote:
> On Thu, Sep 19, 2024 at 04:34:23PM -0400, Peter Colberg wrote:
> > The feature platform device is guaranteed to have an associated platform
> > data. Refactor dfl_fpga_inode_to_feature_dev_data() to directly return
> > the platform data and retrieve the device from the data.
>
> These changelog better describes the change, but the short log does not.
> Please update.
>
> Thanks,
> Yilun
The subject has been revised in the patch "fpga: dfl: return platform
data from dfl_fpga_inode_to_feature_dev_data()".
Thanks,
Peter
>
> >
> > Signed-off-by: Peter Colberg <peter.colberg@intel.com>
> > Reviewed-by: Matthew Gerlach <matthew.gerlach@linux.intel.com>
> > ---
> > drivers/fpga/dfl-afu-main.c | 8 ++------
> > drivers/fpga/dfl-fme-main.c | 7 ++-----
> > drivers/fpga/dfl.h | 6 +++---
> > 3 files changed, 7 insertions(+), 14 deletions(-)
> >
> > diff --git a/drivers/fpga/dfl-afu-main.c b/drivers/fpga/dfl-afu-main.c
> > index 6b97c073849e..6125e2faada8 100644
> > --- a/drivers/fpga/dfl-afu-main.c
> > +++ b/drivers/fpga/dfl-afu-main.c
> > @@ -595,14 +595,10 @@ static struct dfl_feature_driver port_feature_drvs[] = {
> >
> > static int afu_open(struct inode *inode, struct file *filp)
> > {
> > - struct platform_device *fdev = dfl_fpga_inode_to_feature_dev(inode);
> > - struct dfl_feature_platform_data *pdata;
> > + struct dfl_feature_platform_data *pdata = dfl_fpga_inode_to_feature_dev_data(inode);
> > + struct platform_device *fdev = pdata->dev;
> > int ret;
> >
> > - pdata = dev_get_platdata(&fdev->dev);
> > - if (WARN_ON(!pdata))
> > - return -ENODEV;
> > -
> > mutex_lock(&pdata->lock);
> > ret = dfl_feature_dev_use_begin(pdata, filp->f_flags & O_EXCL);
> > if (!ret) {
> > diff --git a/drivers/fpga/dfl-fme-main.c b/drivers/fpga/dfl-fme-main.c
> > index 864924f68f5e..480a187289bb 100644
> > --- a/drivers/fpga/dfl-fme-main.c
> > +++ b/drivers/fpga/dfl-fme-main.c
> > @@ -598,13 +598,10 @@ static long fme_ioctl_check_extension(struct dfl_feature_platform_data *pdata,
> >
> > static int fme_open(struct inode *inode, struct file *filp)
> > {
> > - struct platform_device *fdev = dfl_fpga_inode_to_feature_dev(inode);
> > - struct dfl_feature_platform_data *pdata = dev_get_platdata(&fdev->dev);
> > + struct dfl_feature_platform_data *pdata = dfl_fpga_inode_to_feature_dev_data(inode);
> > + struct platform_device *fdev = pdata->dev;
> > int ret;
> >
> > - if (WARN_ON(!pdata))
> > - return -ENODEV;
> > -
> > mutex_lock(&pdata->lock);
> > ret = dfl_feature_dev_use_begin(pdata, filp->f_flags & O_EXCL);
> > if (!ret) {
> > diff --git a/drivers/fpga/dfl.h b/drivers/fpga/dfl.h
> > index 5063d73b0d82..2285215f444e 100644
> > --- a/drivers/fpga/dfl.h
> > +++ b/drivers/fpga/dfl.h
> > @@ -398,14 +398,14 @@ int dfl_fpga_dev_ops_register(struct platform_device *pdev,
> > struct module *owner);
> > void dfl_fpga_dev_ops_unregister(struct platform_device *pdev);
> >
> > -static inline
> > -struct platform_device *dfl_fpga_inode_to_feature_dev(struct inode *inode)
> > +static inline struct dfl_feature_platform_data *
> > +dfl_fpga_inode_to_feature_dev_data(struct inode *inode)
> > {
> > struct dfl_feature_platform_data *pdata;
> >
> > pdata = container_of(inode->i_cdev, struct dfl_feature_platform_data,
> > cdev);
> > - return pdata->dev;
> > + return pdata;
> > }
> >
> > #define dfl_fpga_dev_for_each_feature(pdata, feature) \
> > --
> > 2.46.1
> >
> >
next prev parent reply other threads:[~2024-10-25 22:41 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-19 20:34 [PATCH v3 0/9] fpga: dfl: fix kernel warning on port release/assign for SRIOV Peter Colberg
2024-09-19 20:34 ` [PATCH v3 1/9] fpga: dfl: omit unneeded argument pdata from dfl_feature_instance_init() Peter Colberg
2024-09-19 20:34 ` [PATCH v3 2/9] fpga: dfl: omit unneeded null pointer check from {afu,fme}_open() Peter Colberg
2024-09-24 6:28 ` Xu Yilun
2024-10-25 22:39 ` Colberg, Peter
2024-09-24 6:41 ` Xu Yilun
2024-10-25 22:40 ` Colberg, Peter [this message]
2024-09-19 20:34 ` [PATCH v3 3/9] fpga: dfl: afu: use parent device to log errors on port enable/disable Peter Colberg
2024-09-19 20:34 ` [PATCH v3 4/9] fpga: dfl: afu: define local pointer to feature device Peter Colberg
2024-09-19 20:34 ` [PATCH v3 5/9] fpga: dfl: pass feature platform data instead of device as argument Peter Colberg
2024-09-19 20:34 ` [PATCH v3 6/9] fpga: dfl: factor out feature data creation from build_info_commit_dev() Peter Colberg
2024-09-24 7:15 ` Xu Yilun
2024-10-25 22:43 ` Colberg, Peter
2024-09-19 20:34 ` [PATCH v3 7/9] fpga: dfl: store FIU type in feature platform data Peter Colberg
2024-09-24 7:42 ` Xu Yilun
2024-10-25 22:46 ` Colberg, Peter
2024-09-19 20:34 ` [PATCH v3 8/9] fpga: dfl: refactor functions to take/return feature device data Peter Colberg
2024-09-19 20:34 ` [PATCH v3 9/9] fpga: dfl: fix kernel warning on port release/assign for SRIOV Peter Colberg
2024-09-24 9:01 ` Xu Yilun
2024-10-25 22:54 ` Colberg, Peter
2024-10-26 1:52 ` Colberg, Peter
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=bb513adfecd4806f73b03ff25a23e80bc69f075d.camel@intel.com \
--to=peter.colberg@intel.com \
--cc=hao.wu@intel.com \
--cc=linux-fpga@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marpagan@redhat.com \
--cc=matthew.gerlach@linux.intel.com \
--cc=mdf@kernel.org \
--cc=russ.weight@linux.dev \
--cc=trix@redhat.com \
--cc=yilun.xu@intel.com \
--cc=yilun.xu@linux.intel.com \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox