public inbox for linux-ide@vger.kernel.org
 help / color / mirror / Atom feed
From: Sergey Shtylyov <s.shtylyov@omp.ru>
To: Damien Le Moal <damien.lemoal@opensource.wdc.com>,
	<linux-ide@vger.kernel.org>
Subject: Re: [PATCH 1/3] ata: make packed transfer mode masks *unsigned int*
Date: Thu, 19 May 2022 23:19:58 +0300	[thread overview]
Message-ID: <97ef20ab-ec3d-d2cb-e90d-645ba3c9dbc9@omp.ru> (raw)
In-Reply-To: <1e32829d-382a-c9c6-a24a-3b3524886700@opensource.wdc.com>

Hello!

On 5/16/22 2:17 PM, Damien Le Moal wrote:

>> The packed transfer mode masks are declared as *unsigned long* (which is
>> a 64-bit type on 64-bit architectures), however the actual mask occupies
>> only 20 bits (7 PIO modes, 5 MWDMA modes, and 8 UDMA modes), so we can
>> safely use 32-bit *unsigned int* variables instead.  Convert all libata
>> functions taking as a parameter or returning a packed transfer mode mask.
>> This saves 470 bytes of object code in libata-core.o alone...
>>
>> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
[...]
>> diff --git a/include/linux/libata.h b/include/linux/libata.h
>> index 732de9014626..1429b7012ae8 100644
>> --- a/include/linux/libata.h
>> +++ b/include/linux/libata.h
[...]
>> @@ -1103,16 +1100,18 @@ extern void ata_msleep(struct ata_port *ap, unsigned int msecs);
>>  extern u32 ata_wait_register(struct ata_port *ap, void __iomem *reg, u32 mask,
>>  			u32 val, unsigned long interval, unsigned long timeout);
>>  extern int atapi_cmd_type(u8 opcode);
>> -extern unsigned long ata_pack_xfermask(unsigned long pio_mask,
>> -			unsigned long mwdma_mask, unsigned long udma_mask);
>> -extern void ata_unpack_xfermask(unsigned long xfer_mask,
>> -			unsigned long *pio_mask, unsigned long *mwdma_mask,
>> -			unsigned long *udma_mask);
>> -extern u8 ata_xfer_mask2mode(unsigned long xfer_mask);
>> -extern unsigned long ata_xfer_mode2mask(u8 xfer_mode);
>> +extern unsigned int ata_pack_xfermask(unsigned long pio_mask,
>> +				      unsigned long mwdma_mask,
>> +				      unsigned long udma_mask);
>> +extern void ata_unpack_xfermask(unsigned int xfer_mask,
>> +				unsigned long *pio_mask,
>> +				unsigned long *mwdma_mask,
>> +				unsigned long *udma_mask);
> 
> Why not change all of these to unsigned int too ?

   Done in the 2nd patch.

> They are defined as "1LU << shift" but everything actually fits within 32 bits

   No, they are #define'd as *int* masks in ata.h, not as *unsigned long* in libata.h...

[...]

MBR, Sergey

  reply	other threads:[~2022-05-19 20:20 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-08 20:41 [PATCH 0/3] Make PATA transfer mode masks always being 32-bit Sergey Shtylyov
2022-05-08 20:41 ` [PATCH 1/3] ata: make packed transfer mode masks *unsigned int* Sergey Shtylyov
2022-05-16 11:17   ` Damien Le Moal
2022-05-19 20:19     ` Sergey Shtylyov [this message]
2022-05-20  3:37       ` Damien Le Moal
2022-06-10 20:19         ` Sergey Shtylyov
2022-06-12 23:18           ` Damien Le Moal
2022-05-08 20:41 ` [PATCH 2/3] ata: make ata_device::{pio|mwdma|udma}_mask " Sergey Shtylyov
2022-05-16 11:19   ` Damien Le Moal
2022-05-19 20:58     ` Sergey Shtylyov
2022-05-20  3:31       ` Damien Le Moal
2022-06-10 21:15         ` Sergey Shtylyov
2022-05-08 20:41 ` [PATCH 3/3] ata: make ata_port_info::{pio|mwdma|udma}_mask " Sergey Shtylyov
2022-05-09 17:57 ` [PATCH 0/3] Make PATA transfer mode masks always being 32-bit Sergey Shtylyov
2022-06-08  6:44 ` Damien Le Moal
2022-06-10 21:20   ` Sergey Shtylyov
2022-06-12 23:24     ` Damien Le Moal
2022-06-13 19:20       ` Sergey Shtylyov
2022-06-14  5:43         ` 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=97ef20ab-ec3d-d2cb-e90d-645ba3c9dbc9@omp.ru \
    --to=s.shtylyov@omp.ru \
    --cc=damien.lemoal@opensource.wdc.com \
    --cc=linux-ide@vger.kernel.org \
    /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