qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Marcel Apfelbaum <marcel@redhat.com>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Alistair Francis" <alistair.francis@xilinx.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Stefan Hajnoczi" <stefanha@redhat.com>
Cc: qemu-devel@nongnu.org, Kevin O'Connor <kevin@koconnor.net>,
	"Edgar E . Iglesias" <edgar.iglesias@xilinx.com>,
	Andrey Smirnov <andrew.smirnov@gmail.com>
Subject: Re: [Qemu-devel] [PATCH v7 06/16] sdhci: add init_readonly_registers() to initialize the CAPAB register
Date: Thu, 18 Jan 2018 17:47:34 +0200	[thread overview]
Message-ID: <2ee34e45-eeec-48e7-3f1f-a5e798a0fc4e@redhat.com> (raw)
In-Reply-To: <16165fc9-6593-8ee9-1dd9-a28400876e66@amsat.org>

On 18/01/2018 17:44, Philippe Mathieu-Daudé wrote:
> On 01/18/2018 09:32 AM, Philippe Mathieu-Daudé wrote:
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>>   hw/sd/sdhci.c | 17 ++++++++++++++---
>>   1 file changed, 14 insertions(+), 3 deletions(-)
>>
>> diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
>> index f9264d3be5..08b85558f1 100644
>> --- a/hw/sd/sdhci.c
>> +++ b/hw/sd/sdhci.c
>> @@ -1174,12 +1174,19 @@ static inline unsigned int sdhci_get_fifolen(SDHCIState *s)
>>       }
>>   }
>>   
>> +static void sdhci_init_readonly_registers(SDHCIState *s, Error **errp)
>> +{
>> +    if (s->capareg == UINT64_MAX) {
>> +        s->capareg = SDHC_CAPAB_REG_DEFAULT;
>> +    }
>> +}
>> +
>>   /* --- qdev common --- */
>>   
>>   #define DEFINE_SDHCI_COMMON_PROPERTIES(_state) \
>> -    /* Capabilities registers provide information on supported features
>> -     * of this specific host controller implementation */ \
>> -    DEFINE_PROP_UINT64("capareg", _state, capareg, SDHC_CAPAB_REG_DEFAULT), \
>> +    /* deprecated: Capabilities registers provide information on supported
>> +     * features of this specific host controller implementation */ \
>> +    DEFINE_PROP_UINT64("capareg", _state, capareg, UINT64_MAX), \
>>       DEFINE_PROP_UINT64("maxcurr", _state, maxcurr, 0)
>>   
>>   static void sdhci_initfn(SDHCIState *s)
>> @@ -1204,6 +1211,10 @@ static void sdhci_uninitfn(SDHCIState *s)
>>   
>>   static void sdhci_common_realize(SDHCIState *s, Error **errp)
>>   {
>> +    sdhci_init_readonly_registers(s, errp);
>> +    if (errp && *errp) {
>

Hi Phillipe,

> Paolo said this is wrong (as in bad pattern?).
> 
> I will respin probably using 'bool sdhci_init_readonly_registers()' instead.
> 

I always use the explanations in include/qapi/error.h
as guidelines.

Thanks,
Marcel

>> +        return;
>> +    }
>>       s->buf_maxsz = sdhci_get_fifolen(s);
>>       s->fifo_buffer = g_malloc0(s->buf_maxsz);
>>   
>>

  reply	other threads:[~2018-01-18 15:47 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-18 12:32 [Qemu-devel] [PATCH v7 00/16] SDHCI: clean v1/v2 Specs (part 2) Philippe Mathieu-Daudé
2018-01-18 12:32 ` [Qemu-devel] [PATCH v7 01/16] sdhci: add qtest to check the SD capabilities register Philippe Mathieu-Daudé
2018-01-18 12:32 ` [Qemu-devel] [PATCH v7 02/16] sdhci: add check_capab_readonly() qtest Philippe Mathieu-Daudé
2018-01-18 12:32 ` [Qemu-devel] [PATCH v7 03/16] sdhci: add a check_capab_baseclock() qtest Philippe Mathieu-Daudé
2018-01-18 12:32 ` [Qemu-devel] [PATCH v7 04/16] sdhci: add a check_capab_sdma() qtest Philippe Mathieu-Daudé
2018-01-18 12:32 ` [Qemu-devel] [PATCH v7 05/16] sdhci: add qtest to check the SD Spec version Philippe Mathieu-Daudé
2018-01-18 12:32 ` [Qemu-devel] [PATCH v7 06/16] sdhci: add init_readonly_registers() to initialize the CAPAB register Philippe Mathieu-Daudé
2018-01-18 15:44   ` Philippe Mathieu-Daudé
2018-01-18 15:47     ` Marcel Apfelbaum [this message]
2018-01-18 16:11       ` Philippe Mathieu-Daudé
2018-01-18 16:00     ` Paolo Bonzini
2018-01-18 16:12       ` Philippe Mathieu-Daudé
2018-01-18 12:32 ` [Qemu-devel] [PATCH v7 07/16] sdhci: add a 'spec_version property' (default to v2) Philippe Mathieu-Daudé
2018-01-18 12:32 ` [Qemu-devel] [PATCH v7 08/16] sdhci: add basic Spec v1 capabilities Philippe Mathieu-Daudé
2018-01-18 15:45   ` Philippe Mathieu-Daudé
2018-01-18 16:04     ` Paolo Bonzini
2018-01-18 12:32 ` [Qemu-devel] [PATCH v7 09/16] sdhci: add max-block-length capability (Spec v1) Philippe Mathieu-Daudé
2018-01-18 12:32 ` [Qemu-devel] [PATCH v7 12/16] sdhci: Fix 64-bit ADMA2 Philippe Mathieu-Daudé
2018-01-18 12:32 ` [Qemu-devel] [PATCH v7 14/16] hw/arm/xilinx_zynq: implement SDHCI Spec v2 Philippe Mathieu-Daudé
2018-01-18 12:32 ` [Qemu-devel] [PATCH v7 15/16] hw/arm/exynos4210: " Philippe Mathieu-Daudé
2018-01-18 12:32 ` [Qemu-devel] [PATCH v7 16/16] sdhci: throw an error if capabilities are incorrectly configured Philippe Mathieu-Daudé
2018-01-18 18:19   ` Alistair Francis

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=2ee34e45-eeec-48e7-3f1f-a5e798a0fc4e@redhat.com \
    --to=marcel@redhat.com \
    --cc=alistair.francis@xilinx.com \
    --cc=andrew.smirnov@gmail.com \
    --cc=edgar.iglesias@xilinx.com \
    --cc=f4bug@amsat.org \
    --cc=kevin@koconnor.net \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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;
as well as URLs for NNTP newsgroup(s).