qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Tejaswini Poluri <tejaswinipoluri3@gmail.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: qemu-devel@nongnu.org, kwolf@redhat.com,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [[RFC]PATCH:hw/sd:sd_init()] hw/sd : modified the sd_init() function
Date: Tue, 28 Mar 2017 11:01:05 +0530	[thread overview]
Message-ID: <CAH=b03tqB4vy0fg3ikhf1iGpbQyLfDd28ymrO_Qo_QSysHOAKA@mail.gmail.com> (raw)
In-Reply-To: <20170327111309.GB26900@stefanha-x1.localdomain>

On Mon, Mar 27, 2017 at 4:43 PM, Stefan Hajnoczi <stefanha@redhat.com>
wrote:

> On Mon, Mar 27, 2017 at 04:01:02PM +0530, Tejaswini wrote:
> > From: Tejaswini Poluri <tejaswinipoluri3@gmail.com>
>
> Please shorten the subject line: "[PATCH] hw/sd: simplify sd_init()
> prototype"
>
> > @@ -573,16 +573,19 @@ SDState *sd_init(BlockBackend *blk, bool is_spi)
> >      qdev_prop_set_drive(dev, "drive", blk, &err);
> >      if (err) {
> >          error_report("sd_init failed: %s", error_get_pretty(err));
> > -        return NULL;
> > +        return -1;
> >      }
> >      qdev_prop_set_bit(dev, "spi", is_spi);
> >      object_property_set_bool(obj, true, "realized", &err);
> >      if (err) {
> >          error_report("sd_init failed: %s", error_get_pretty(err));
> > -        return NULL;
> > +        return -1;
> >      }
> > -
> > -    return SD_CARD(dev);
> > +    sd_state = SD_CARD(dev);
>
> The caller will not see the new value of sd_state.  In C arguments are
> passed by value.  That means they are local variables inside the
> function and do not affect the caller.
>
> The caller will call sd_init() along with passing SDState pointer as an
argument like below
if (sd_init(s->card, blk, false) < 0) .
And the sd_init() function is modified to
int sd_init(SDState *sd_state, BlockBackend *blk, bool is_spi)
so that the caller gets the new value of SDstate updated.
Looking forward for the comments of Paolo Bonzini to understand what more
needs to be done as part of the task.

I have CCed Paolo Bonzini, who posted this task.  Maybe he can explain
> what he meant by "Include SDState by value instead of allocating it in
> sd_init (hw/sd/)".
>
> > +    if (!sd_state) {
> > +             return -1;
> > +     }
>
> QEMU use 4 space indentation.  Please do not use tabs.
>



-- 
Regards,
Tejaswini

  reply	other threads:[~2017-03-28  5:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-27 10:31 [Qemu-devel] [[RFC]PATCH:hw/sd:sd_init()] hw/sd : modified the sd_init() function Tejaswini
2017-03-27 11:13 ` Stefan Hajnoczi
2017-03-28  5:31   ` Tejaswini Poluri [this message]
2017-04-09  0:14     ` Tejaswini Poluri
2017-04-18  7:05       ` Tejaswini Poluri

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='CAH=b03tqB4vy0fg3ikhf1iGpbQyLfDd28ymrO_Qo_QSysHOAKA@mail.gmail.com' \
    --to=tejaswinipoluri3@gmail.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --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).