Message ID | 20190320200920.34036-3-bvanassche@acm.org (mailing list archive) |
---|---|
State | Mainlined |
Commit | d16ece577bf2cee7f94bab75a0d967bcb89dd2a7 |
Headers | show |
Series | sd: Rely on the driver core for asynchronous probing | expand |
On Wed, Mar 20, 2019 at 01:09:20PM -0700, Bart Van Assche wrote:
> This patch does not change any functionality.
Then why do it?
You need to say _why_ a patch is needed in order for people to want to
take it...
thanks,
greg k-h
On Wed, 2019-03-20 at 21:14 +0100, Greg Kroah-Hartman wrote: > On Wed, Mar 20, 2019 at 01:09:20PM -0700, Bart Van Assche wrote: > > This patch does not change any functionality. > > Then why do it? > > You need to say _why_ a patch is needed in order for people to want to > take it... Hi Greg, You are right of course. The reason I would like to inline that function is because it was essential in the past to have that code as a separate function but after patch 1/2 inlining that function makes sd_probe() easier to read. Martin, do you want me to resubmit this patch series with an updated commit message or do you rather prefer to update the commit message yourself? Thanks, Bart.
Bart, > You are right of course. The reason I would like to inline that > function is because it was essential in the past to have that code as > a separate function but after patch 1/2 inlining that function makes > sd_probe() easier to read. Martin, do you want me to resubmit this > patch series with an updated commit message or do you rather prefer to > update the commit message yourself? Just mail me a reworded blurb.
On Wed, 2019-03-20 at 20:35 -0400, Martin K. Petersen wrote: > Bart, > > > You are right of course. The reason I would like to inline that > > function is because it was essential in the past to have that code as > > a separate function but after patch 1/2 inlining that function makes > > sd_probe() easier to read. Martin, do you want me to resubmit this > > patch series with an updated commit message or do you rather prefer to > > update the commit message yourself? > > Just mail me a reworded blurb. Hi Martin, How about the following: ----------------------------------------------------------------------- Make sd_probe() easier to read by inlining sd_probe_part2(). This patch does not change any functionality. ----------------------------------------------------------------------- Thanks, Bart.
On 3/21/19 2:39 PM, Bart Van Assche wrote: > On Wed, 2019-03-20 at 20:35 -0400, Martin K. Petersen wrote: >> Bart, >> >>> You are right of course. The reason I would like to inline that >>> function is because it was essential in the past to have that code as >>> a separate function but after patch 1/2 inlining that function makes >>> sd_probe() easier to read. Martin, do you want me to resubmit this >>> patch series with an updated commit message or do you rather prefer to >>> update the commit message yourself? >> >> Just mail me a reworded blurb. > > Hi Martin, > > How about the following: > ----------------------------------------------------------------------- > Make sd_probe() easier to read by inlining sd_probe_part2(). This patch > does not change any functionality. > ----------------------------------------------------------------------- > Thanks, > > Bart. > Given the updated blurb: Reviewed-by: Lee Duncan <lduncan@suse.com>
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 5fd4eb7be907..ed34bfbc3844 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -3287,63 +3287,6 @@ static int sd_format_disk_name(char *prefix, int index, char *buf, int buflen) return 0; } -static void sd_probe_part2(struct scsi_disk *sdkp) -{ - struct scsi_device *sdp; - struct gendisk *gd; - u32 index; - struct device *dev; - - sdp = sdkp->device; - gd = sdkp->disk; - index = sdkp->index; - dev = &sdp->sdev_gendev; - - gd->major = sd_major((index & 0xf0) >> 4); - gd->first_minor = ((index & 0xf) << 4) | (index & 0xfff00); - - gd->fops = &sd_fops; - gd->private_data = &sdkp->driver; - gd->queue = sdkp->device->request_queue; - - /* defaults, until the device tells us otherwise */ - sdp->sector_size = 512; - sdkp->capacity = 0; - sdkp->media_present = 1; - sdkp->write_prot = 0; - sdkp->cache_override = 0; - sdkp->WCE = 0; - sdkp->RCD = 0; - sdkp->ATO = 0; - sdkp->first_scan = 1; - sdkp->max_medium_access_timeouts = SD_MAX_MEDIUM_TIMEOUTS; - - sd_revalidate_disk(gd); - - gd->flags = GENHD_FL_EXT_DEVT; - if (sdp->removable) { - gd->flags |= GENHD_FL_REMOVABLE; - gd->events |= DISK_EVENT_MEDIA_CHANGE; - } - - blk_pm_runtime_init(sdp->request_queue, dev); - device_add_disk(dev, gd, NULL); - if (sdkp->capacity) - sd_dif_config_host(sdkp); - - sd_revalidate_disk(gd); - - if (sdkp->security) { - sdkp->opal_dev = init_opal_dev(sdp, &sd_sec_submit); - if (sdkp->opal_dev) - sd_printk(KERN_NOTICE, sdkp, "supports TCG Opal\n"); - } - - sd_printk(KERN_NOTICE, sdkp, "Attached SCSI %sdisk\n", - sdp->removable ? "removable " : ""); - scsi_autopm_put_device(sdp); -} - /** * sd_probe - called during driver initialization and whenever a * new scsi device is attached to the system. It is called once @@ -3433,7 +3376,49 @@ static int sd_probe(struct device *dev) get_device(dev); dev_set_drvdata(dev, sdkp); - sd_probe_part2(sdkp); + gd->major = sd_major((index & 0xf0) >> 4); + gd->first_minor = ((index & 0xf) << 4) | (index & 0xfff00); + + gd->fops = &sd_fops; + gd->private_data = &sdkp->driver; + gd->queue = sdkp->device->request_queue; + + /* defaults, until the device tells us otherwise */ + sdp->sector_size = 512; + sdkp->capacity = 0; + sdkp->media_present = 1; + sdkp->write_prot = 0; + sdkp->cache_override = 0; + sdkp->WCE = 0; + sdkp->RCD = 0; + sdkp->ATO = 0; + sdkp->first_scan = 1; + sdkp->max_medium_access_timeouts = SD_MAX_MEDIUM_TIMEOUTS; + + sd_revalidate_disk(gd); + + gd->flags = GENHD_FL_EXT_DEVT; + if (sdp->removable) { + gd->flags |= GENHD_FL_REMOVABLE; + gd->events |= DISK_EVENT_MEDIA_CHANGE; + } + + blk_pm_runtime_init(sdp->request_queue, dev); + device_add_disk(dev, gd, NULL); + if (sdkp->capacity) + sd_dif_config_host(sdkp); + + sd_revalidate_disk(gd); + + if (sdkp->security) { + sdkp->opal_dev = init_opal_dev(sdp, &sd_sec_submit); + if (sdkp->opal_dev) + sd_printk(KERN_NOTICE, sdkp, "supports TCG Opal\n"); + } + + sd_printk(KERN_NOTICE, sdkp, "Attached SCSI %sdisk\n", + sdp->removable ? "removable " : ""); + scsi_autopm_put_device(sdp); return 0;
This patch does not change any functionality. Cc: Lee Duncan <lduncan@suse.com> Cc: Hannes Reinecke <hare@suse.com> Cc: Luis Chamberlain <mcgrof@kernel.org> Cc: Johannes Thumshirn <jthumshirn@suse.de> Cc: Christoph Hellwig <hch@lst.de> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Bart Van Assche <bvanassche@acm.org> --- drivers/scsi/sd.c | 101 ++++++++++++++++++++-------------------------- 1 file changed, 43 insertions(+), 58 deletions(-)