From: Hannes Reinecke <hare@suse.de> To: Damien Le Moal <Damien.LeMoal@wdc.com>, Jens Axboe <axboe@kernel.dk>, "linux-block@vger.kernel.org" <linux-block@vger.kernel.org>, "linux-ide@vger.kernel.org" <linux-ide@vger.kernel.org>, "Martin K . Petersen" <martin.petersen@oracle.com>, "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org> Cc: Sathya Prakash <sathya.prakash@broadcom.com>, Sreekanth Reddy <sreekanth.reddy@broadcom.com>, Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com> Subject: Re: [PATCH v2 4/9] libata: cleanup ata_dev_configure() Date: Fri, 6 Aug 2021 11:28:15 +0200 [thread overview] Message-ID: <0fd18f2f-dc71-9d57-cfb3-afca4b37b3e9@suse.de> (raw) In-Reply-To: <DM6PR04MB708145CEBEF79D709B679090E7F39@DM6PR04MB7081.namprd04.prod.outlook.com> On 8/6/21 11:12 AM, Damien Le Moal wrote: > On 2021/08/06 18:07, Hannes Reinecke wrote: >> On 8/6/21 9:42 AM, Damien Le Moal wrote: >>> Introduce the helper functions ata_dev_config_lba() and >>> ata_dev_config_chs() to configure the addressing capabilities of a >>> device. Each helper takes a string as argument for the addressing >>> information printed after these helpers execution completes. >>> >>> Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> >>> --- >>> drivers/ata/libata-core.c | 110 ++++++++++++++++++++------------------ >>> 1 file changed, 59 insertions(+), 51 deletions(-) >>> >>> diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c >>> index b13194432e5a..2b6054cdd8fc 100644 >>> --- a/drivers/ata/libata-core.c >>> +++ b/drivers/ata/libata-core.c [ .. ] >>> return rc; >>> - >>> - /* print device info to dmesg */ >>> - if (ata_msg_drv(ap) && print_info) { >>> - ata_dev_info(dev, "%s: %s, %s, max %s\n", >>> - revbuf, modelbuf, fwrevbuf, >>> - ata_mode_string(xfer_mask)); >>> - ata_dev_info(dev, >>> - "%llu sectors, multi %u: %s %s\n", >>> - (unsigned long long)dev->n_sectors, >>> - dev->multi_count, lba_desc, ncq_desc); >>> - } >>> } else { >>> - /* CHS */ >>> - >>> - /* Default translation */ >>> - dev->cylinders = id[1]; >>> - dev->heads = id[3]; >>> - dev->sectors = id[6]; >>> - >>> - if (ata_id_current_chs_valid(id)) { >>> - /* Current CHS translation is valid. */ >>> - dev->cylinders = id[54]; >>> - dev->heads = id[55]; >>> - dev->sectors = id[56]; >>> - } >>> + ata_dev_config_chs(dev, lba_info, sizeof(lba_info)); >>> + } >>> >>> - /* print device info to dmesg */ >>> - if (ata_msg_drv(ap) && print_info) { >>> - ata_dev_info(dev, "%s: %s, %s, max %s\n", >>> - revbuf, modelbuf, fwrevbuf, >>> - ata_mode_string(xfer_mask)); >>> - ata_dev_info(dev, >>> - "%llu sectors, multi %u, CHS %u/%u/%u\n", >>> - (unsigned long long)dev->n_sectors, >>> - dev->multi_count, dev->cylinders, >>> - dev->heads, dev->sectors); >>> - } >>> + /* print device info to dmesg */ >>> + if (ata_msg_drv(ap) && print_info) { >>> + ata_dev_info(dev, "%s: %s, %s, max %s\n", >>> + revbuf, modelbuf, fwrevbuf, >>> + ata_mode_string(xfer_mask)); >>> + ata_dev_info(dev, >>> + "%llu sectors, multi %u, %s\n", >>> + (unsigned long long)dev->n_sectors, >>> + dev->multi_count, lba_info); >>> } >>> >>> ata_dev_config_devslp(dev); >>> >> Hmm. Can't say I like it. >> Can't you move the second 'ata_dev_info()' call into the respective >> functions, and kill the temporary buffer? > > That would reverse the order of the messages... And I wanted to avoid having an > "if (ata_id_has_lba(id))" again just for the print. Moving the 2 ata_dev_info() > calls into the respective functions was the other solution I tried, but then the > functions require *a lot* more arguments (revbuf, modelbuf, fwrevbuf, ...) wich > was not super nice. > > This one is the least ugly I thought... Any other idea ? > Well, it should be possible to move the first 'ata_dev_info()' call _prior_ to the if(ata_id_has_lba(id)) condition, and then we can move the second call into the respective functions, no? Cheers, Hannes -- Dr. Hannes Reinecke Kernel Storage Architect hare@suse.de +49 911 74053 688 SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), GF: Felix Imendörffer
next prev parent reply other threads:[~2021-08-06 9:28 UTC|newest] Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-08-06 7:42 [PATCH v2 0/9] libata cleanups and improvements Damien Le Moal 2021-08-06 7:42 ` [PATCH v2 1/9] libata: fix ata_host_alloc_pinfo() Damien Le Moal 2021-08-06 8:49 ` Hannes Reinecke 2021-08-06 14:25 ` James Bottomley 2021-08-06 14:31 ` Damien Le Moal 2021-08-06 7:42 ` [PATCH v2 2/9] libata: fix ata_host_start() Damien Le Moal 2021-08-06 8:50 ` Hannes Reinecke 2021-08-06 14:31 ` James Bottomley 2021-08-06 14:33 ` Damien Le Moal 2021-08-07 3:32 ` Damien Le Moal 2021-08-06 7:42 ` [PATCH v2 3/9] libata: cleanup device sleep capability detection Damien Le Moal 2021-08-06 8:50 ` Hannes Reinecke 2021-08-06 7:42 ` [PATCH v2 4/9] libata: cleanup ata_dev_configure() Damien Le Moal 2021-08-06 9:07 ` Hannes Reinecke 2021-08-06 9:12 ` Damien Le Moal 2021-08-06 9:28 ` Hannes Reinecke [this message] 2021-08-06 9:32 ` Damien Le Moal 2021-08-06 7:42 ` [PATCH v2 5/9] libata: cleanup NCQ priority handling Damien Le Moal 2021-08-06 9:09 ` Hannes Reinecke 2021-08-06 7:42 ` [PATCH v2 6/9] libata: fix ata_read_log_page() warning Damien Le Moal 2021-08-06 9:10 ` Hannes Reinecke 2021-08-06 7:42 ` [PATCH v2 7/9] libata: print feature list on device scan Damien Le Moal 2021-08-06 9:11 ` Hannes Reinecke 2021-08-06 7:42 ` [PATCH v2 8/9] libahci: Introduce ncq_prio_supported sysfs sttribute Damien Le Moal 2021-08-06 7:42 ` [PATCH v2 9/9] scsi: mpt3sas: Introduce sas_ncq_prio_supported " Damien Le Moal 2021-08-06 9:12 ` Hannes Reinecke 2021-08-06 9:16 ` Damien Le Moal
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=0fd18f2f-dc71-9d57-cfb3-afca4b37b3e9@suse.de \ --to=hare@suse.de \ --cc=Damien.LeMoal@wdc.com \ --cc=axboe@kernel.dk \ --cc=linux-block@vger.kernel.org \ --cc=linux-ide@vger.kernel.org \ --cc=linux-scsi@vger.kernel.org \ --cc=martin.petersen@oracle.com \ --cc=sathya.prakash@broadcom.com \ --cc=sreekanth.reddy@broadcom.com \ --cc=suganath-prabu.subramani@broadcom.com \ --subject='Re: [PATCH v2 4/9] libata: cleanup ata_dev_configure()' \ /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
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).