public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Daejun Park <daejun7.park@samsung.com>
To: Bart Van Assche <bvanassche@acm.org>,
	Daejun Park <daejun7.park@samsung.com>,
	"avri.altman@wdc.com" <avri.altman@wdc.com>,
	"jejb@linux.ibm.com" <jejb@linux.ibm.com>,
	"martin.petersen@oracle.com" <martin.petersen@oracle.com>,
	"asutoshd@codeaurora.org" <asutoshd@codeaurora.org>,
	"beanhuo@micron.com" <beanhuo@micron.com>,
	"stanley.chu@mediatek.com" <stanley.chu@mediatek.com>,
	"cang@codeaurora.org" <cang@codeaurora.org>,
	"tomas.winkler@intel.com" <tomas.winkler@intel.com>,
	ALIM AKHTAR <alim.akhtar@samsung.com>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Sang-yoon Oh <sangyoon.oh@samsung.com>,
	Sung-Jun Park <sungjun07.park@samsung.com>,
	yongmyung lee <ymhungry.lee@samsung.com>,
	Jinyoung CHOI <j-young.choi@samsung.com>,
	Adel Choi <adel.choi@samsung.com>,
	BoRam Shin <boram.shin@samsung.com>
Subject: Re: [PATCH v9 2/4] scsi: ufs: Introduce HPB feature
Date: Tue, 01 Sep 2020 09:24:29 +0900	[thread overview]
Message-ID: <963815509.21598920082632.JavaMail.epsvc@epcpadp2> (raw)
In-Reply-To: <93f1cf18-30da-4482-9a0d-c46d2f70bd15@acm.org>

Hi, Bart

> > diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
> > index 618b253e5ec8..df30622a2b67 100644
> > --- a/drivers/scsi/ufs/ufshcd.h
> > +++ b/drivers/scsi/ufs/ufshcd.h
> > @@ -588,6 +588,24 @@ struct ufs_hba_variant_params {
> >  	u16 hba_enable_delay_us;
> >  	u32 wb_flush_threshold;
> >  };
> > +#ifdef CONFIG_SCSI_UFS_HPB
> > +/**
> > + * struct ufshpb_dev_info - UFSHPB device related info
> > + * @num_lu: the number of user logical unit to check whether all lu finished
> > + *          initialization
> > + * @rgn_size: device reported HPB region size
> > + * @srgn_size: device reported HPB sub-region size
> > + * @slave_conf_cnt: counter to check all lu finished initialization
> > + * @hpb_disabled: flag to check if HPB is disabled
> > + */
> > +struct ufshpb_dev_info {
> > +	int num_lu;
> > +	int rgn_size;
> > +	int srgn_size;
> > +	atomic_t slave_conf_cnt;
> > +	bool hpb_disabled;
> > +};
> > +#endif
> 
> Please insert a blank line above "#ifdef CONFIG_SCSI_UFS_HPB"

OK, I will insert a blank line.
 
> > +/* HPB enabled lu list */
> > +static LIST_HEAD(lh_hpb_lu);
> 
> Is it necessary to maintain this list? Or in other words, is it possible to
> change all list_for_each_entry(hpb, &lh_hpb_lu, list_hpb_lu) calls into
> shost_for_each_device() calls?

OK, I will remove lh_hpb_lu.

> > +/* SYSFS functions */
> > +#define ufshpb_sysfs_attr_show_func(__name)				\
> > +static ssize_t __name##_show(struct device *dev,			\
> > +	struct device_attribute *attr, char *buf)			\
> > +{									\
> > +	struct scsi_device *sdev = to_scsi_device(dev);			\
> > +	struct ufshpb_lu *hpb = sdev->hostdata;				\
> > +	if (!hpb)							\
> > +		return -ENOENT;						\
> > +	return snprintf(buf, PAGE_SIZE, "%d\n",				\
> > +			atomic_read(&hpb->stats.__name));		\
> > +}									\
> > +static DEVICE_ATTR_RO(__name)
> 
> Please leave a blank line after declarations (between the "hpb" declaration
> and "if (!hpb)").

OK, I will add a blank line.

> > +#ifndef CONFIG_SCSI_UFS_HPB
> > +[...]
> > +static struct attribute *hpb_dev_attrs[] = { NULL,};
> > +static struct attribute_group ufs_sysfs_hpb_stat_group = {.attrs = hpb_dev_attrs,};
> > +#else
> > +[...]
> > +extern struct attribute_group ufs_sysfs_hpb_stat_group;
> > +#endif
> 
> Defining static variables or arrays in header files is questionable because
> the definition of these variables will be duplicated in each source file that
> header file is included in. Although the general rule for kernel code is to
> confine #ifdefs to header files, for ufs_sysfs_hpb_stat_group I think that
> it is better to surround its use with #ifndef CONFIG_SCSI_UFS_HPB / #endif
> instead of defining a dummy structure as static variable in a header file if
> HPB support is disabled.

OK, I added #ifdef in ufshcd.c.

static const struct attribute_group *ufshcd_driver_groups[] = {
	&ufs_sysfs_unit_descriptor_group,
	&ufs_sysfs_lun_attributes_group,
#ifdef CONFIG_SCSI_UFS_HPB
	&ufs_sysfs_hpb_stat_group,
#endif
	NULL,
};

Thanks,
Daejun

  reply	other threads:[~2020-09-01  0:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20200828070950epcms2p5470bd43374be18d184dd802da09e73c8@epcms2p5>
2020-08-28  7:09 ` [PATCH v9 0/4] scsi: ufs: Add Host Performance Booster Support Daejun Park
2020-08-28  7:17   ` [PATCH v9 1/4] scsi: ufs: Add HPB feature related parameters Daejun Park
2020-08-29 23:11     ` Bart Van Assche
2020-08-28  7:18   ` [PATCH v9 2/4] scsi: ufs: Introduce HPB feature Daejun Park
2020-08-29 22:58     ` Bart Van Assche
2020-09-01  0:24       ` Daejun Park [this message]
2020-08-28  7:19   ` [PATCH v9 3/4] scsi: ufs: L2P map management for HPB read Daejun Park
2020-08-29 23:48     ` Bart Van Assche
2020-09-01  0:21       ` Daejun Park
2020-08-28  7:19   ` [PATCH v9 4/4] scsi: ufs: Prepare HPB read for cached sub-region Daejun Park
2020-08-29 23:54     ` Bart Van Assche

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=963815509.21598920082632.JavaMail.epsvc@epcpadp2 \
    --to=daejun7.park@samsung.com \
    --cc=adel.choi@samsung.com \
    --cc=alim.akhtar@samsung.com \
    --cc=asutoshd@codeaurora.org \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=boram.shin@samsung.com \
    --cc=bvanassche@acm.org \
    --cc=cang@codeaurora.org \
    --cc=j-young.choi@samsung.com \
    --cc=jejb@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=sangyoon.oh@samsung.com \
    --cc=stanley.chu@mediatek.com \
    --cc=sungjun07.park@samsung.com \
    --cc=tomas.winkler@intel.com \
    --cc=ymhungry.lee@samsung.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