[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH V2 04/10] hw/sd.c: make sd_wp_addr() return bool
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH V2 04/10] hw/sd.c: make sd_wp_addr() return bool |
Date: |
Wed, 11 Apr 2012 10:59:12 +0100 |
On 5 April 2012 16:48, Igor Mitsyanko <address@hidden> wrote:
> For the sake of code clarity
>
> Signed-off-by: Igor Mitsyanko <address@hidden>
> ---
> hw/sd.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/sd.c b/hw/sd.c
> index e1c998c..7160e8c 100644
> --- a/hw/sd.c
> +++ b/hw/sd.c
> @@ -539,9 +539,9 @@ static void sd_function_switch(SDState *sd, uint32_t arg)
> sd->data[66] = crc & 0xff;
> }
>
> -static inline int sd_wp_addr(SDState *sd, uint32_t addr)
> +static inline bool sd_wp_addr(SDState *sd, uint32_t addr)
> {
> - return test_bit(addr >> (HWBLOCK_SHIFT + SECTOR_SHIFT + WPGROUP_SHIFT),
> + return !!test_bit(addr >> (HWBLOCK_SHIFT + SECTOR_SHIFT + WPGROUP_SHIFT),
> sd->wp_groups);
> }
The !! is unnecessary: (a) test_bit always returns 0 or 1 and (b)
the cast from int to bool will convert anything-not-zero to 1 anyway.
-- PMM
- Re: [Qemu-devel] [PATCH V2 10/10] hw/sd.c: introduce SD card "image" property and allow SD hot-insert, (continued)
[Qemu-devel] [PATCH V2 08/10] SD card: introduce "spi_mode" property for SD card objects, Igor Mitsyanko, 2012/04/05
[Qemu-devel] [PATCH V2 06/10] hw/sd.c: convert to QOM object, Igor Mitsyanko, 2012/04/05
[Qemu-devel] [PATCH V2 02/10] hw/sd.c: convert binary variables to bool, Igor Mitsyanko, 2012/04/05
[Qemu-devel] [PATCH V2 04/10] hw/sd.c: make sd_wp_addr() return bool, Igor Mitsyanko, 2012/04/05
- Re: [Qemu-devel] [PATCH V2 04/10] hw/sd.c: make sd_wp_addr() return bool,
Peter Maydell <=
[Qemu-devel] [PATCH V2 09/10] SD card: make SD card a child of host controller, Igor Mitsyanko, 2012/04/05