Linux CXL
 help / color / mirror / Atom feed
From: Robert Richter <rrichter@amd.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: Dave Jiang <dave.jiang@intel.com>,
	linux-cxl@vger.kernel.org, Ira Weiny <ira.weiny@intel.com>,
	vishal.l.verma@intel.com, alison.schofield@intel.com,
	Jonathan.Cameron@huawei.com, dave@stgolabs.net
Subject: Re: [PATCH v6 2/5] cxl: Convert find_cxl_root() to return a 'struct cxl_root *'
Date: Mon, 8 Jan 2024 23:30:55 +0100	[thread overview]
Message-ID: <ZZx3n76CQVlevdwn@rric.localdomain> (raw)
In-Reply-To: <659c5e868d50b_127da229425@dwillia2-xfh.jf.intel.com.notmuch>

On 08.01.24 12:43:50, Dan Williams wrote:
> Robert Richter wrote:
> > On 05.01.24 15:07:40, Dave Jiang wrote:

> > > @@ -349,15 +348,19 @@ static int cxl_qos_class_verify(struct cxl_memdev *cxlmd)
> > >  {
> > >  	struct cxl_dev_state *cxlds = cxlmd->cxlds;
> > >  	struct cxl_memdev_state *mds = to_cxl_memdev_state(cxlds);
> > > -	struct cxl_port *root_port __free(put_device) = NULL;
> > >  	LIST_HEAD(__discard);
> > >  	struct list_head *discard __free(dpa_perf) = &__discard;
> > > +	struct cxl_port *root_port;
> > >  	int rc;
> > >  
> > > -	root_port = find_cxl_root(cxlmd->endpoint);
> > > -	if (!root_port)
> > > +	struct cxl_root *cxl_root __free(put_cxl_root) =
> > > +		find_cxl_root(cxlmd->endpoint);
> > 
> > That's the drawback that lines get very long. Not sure if that was
> > discussed before, maybe just assign NULL in the definition and then
> > have the first assignment right after?
> 
> That style recommendation was something we were discussing here:
> 
> http://lore.kernel.org/r/20240104223725.GA1829769@bhelgaas
> 
> ...where the outcome I took away was "try to keep the get/put in the
> same statement, especially if the function has multiple usages of
> __free()".

I see the point here. An alternative would be to have one __free per
block, but additional blocks would introduce indentation. Maybe worth
to consider anyway as that addresses the style issue too.

I am fine that my other comments are addressed with top patches too.

Thanks,

-Robert

  reply	other threads:[~2024-01-08 22:31 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-05 22:07 [PATCH v6 0/5] cxl: find_cxl_root() related cleanups Dave Jiang
2024-01-05 22:07 ` [PATCH v6 1/5] cxl: Introduce put_cxl_root() helper Dave Jiang
2024-01-05 22:14   ` Robert Richter
2024-01-05 22:07 ` [PATCH v6 2/5] cxl: Convert find_cxl_root() to return a 'struct cxl_root *' Dave Jiang
2024-01-05 22:51   ` Robert Richter
2024-01-05 23:08     ` Dave Jiang
2024-01-05 23:34     ` Dave Jiang
2024-01-08 20:43     ` Dan Williams
2024-01-08 22:30       ` Robert Richter [this message]
2024-01-05 22:07 ` [PATCH v6 3/5] cxl: Fix device reference leak in cxl_port_perf_data_calculate() Dave Jiang
2024-01-05 22:56   ` Robert Richter
2024-01-05 23:59     ` Dave Jiang
2024-01-08 21:03       ` Dan Williams
2024-01-05 22:07 ` [PATCH v6 4/5] cxl: Refactor to use __free() for cxl_root allocation in cxl_find_nvdimm_bridge() Dave Jiang
2024-01-05 23:06   ` Robert Richter
2024-01-05 22:07 ` [PATCH v6 5/5] cxl: Refactor to use __free() for cxl_root allocation in cxl_endpoint_port_probe() Dave Jiang
2024-01-05 23:09   ` Robert Richter
2024-01-05 22:35 ` [PATCH v6 0/5] cxl: find_cxl_root() related cleanups Dan Williams
2024-01-08 11:53   ` Jonathan Cameron
2024-01-08 21:05     ` Dan Williams
2024-01-09  1:07 ` [PATCH 1/3] cxl: Remove cxl_root check after find_cxl_root Dave Jiang
2024-01-09  1:16   ` Dan Williams
2024-01-09  1:07 ` [PATCH 2/3] cxl: Cleanup unnecessary uages of cxl_port local vars from cxl_root Dave Jiang
2024-01-09  1:17   ` Dan Williams
2024-01-09 15:29   ` Jonathan Cameron
2024-01-09 15:38     ` Dave Jiang
2024-01-09  1:07 ` [PATCH 3/3] cxl: Make calling of find_cxl_root() declaration uniform Dave Jiang
2024-01-09  1:37   ` Dan Williams

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=ZZx3n76CQVlevdwn@rric.localdomain \
    --to=rrichter@amd.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=alison.schofield@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=dave@stgolabs.net \
    --cc=ira.weiny@intel.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=vishal.l.verma@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