From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 2/5] ALSA: ctxfi: initialized snd_card
Date: Tue, 23 Sep 2014 20:16:45 +0530 [thread overview]
Message-ID: <20140923144644.GA19585@sudip-PC> (raw)
In-Reply-To: <s5ha95q5szf.wl-tiwai@suse.de>
On Tue, Sep 23, 2014 at 04:09:08PM +0200, Takashi Iwai wrote:
> At Tue, 23 Sep 2014 16:30:21 +0530,
> Sudip Mukherjee wrote:
> >
> > initialized the reference of snd_card which was added to the various
> > structures through the previous patch of the series.
> > these references of snd_card will be used in a later patch to convert
> > the pr_* macros to dev_*
> >
> > Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> > ---
> > sound/pci/ctxfi/ctamixer.c | 2 ++
> > sound/pci/ctxfi/ctatc.c | 1 +
> > sound/pci/ctxfi/ctdaio.c | 1 +
> > sound/pci/ctxfi/ctsrc.c | 2 ++
> > 4 files changed, 6 insertions(+)
> >
> > diff --git a/sound/pci/ctxfi/ctamixer.c b/sound/pci/ctxfi/ctamixer.c
> > index fed6e6a..dc89fad 100644
> > --- a/sound/pci/ctxfi/ctamixer.c
> > +++ b/sound/pci/ctxfi/ctamixer.c
> > @@ -314,6 +314,7 @@ int amixer_mgr_create(void *hw, struct amixer_mgr **ramixer_mgr)
> >
> > amixer_mgr->get_amixer = get_amixer_rsc;
> > amixer_mgr->put_amixer = put_amixer_rsc;
> > + amixer_mgr->card = ((struct hw *)hw)->card;
>
> Overall the patches became obviously better now, but unfortunately
> we still see such rather stupid cast occasionally. I guess you
> considered reducing these?
frankly speaking , i did not think to reduce that untill now that u mentioned it.
I was thinking it was there for a reason and will be used like the private_data,
but i was not able to think of any reason as everywhere it is struct hw.
thanks
sudip
>
> Then start thinking from the scratch: why the cast is needed at all?
> It's because the driver uses the void pointer for hw objects. Why?
> The driver author tried to separate the code abstraction, and thought
> to pass the arbitrary hw object.
>
> Such abstraction would be good if really different objects are
> handled. OTOH, in ctxfi case, we know that we deal with only a single
> hw type. So, using void * for hw object is rather error-prone, and
> the code safety can be even improved by strict typing.
>
> That said, replacing void * with struct hw * or such would make things
> not only easier but also safer.
>
> BTW, the patch 5 is basically independent from the rest, and it's good
> enough, so I applied it now. At the next respin, please drop that
> patch from your series.
>
>
> thanks,
>
> Takashi
next prev parent reply other threads:[~2014-09-23 14:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-23 11:00 [PATCH v4 1/5] ALSA: ctxfi: added reference of snd_card Sudip Mukherjee
2014-09-23 11:00 ` [PATCH v4 2/5] ALSA: ctxfi: initialized snd_card Sudip Mukherjee
2014-09-23 14:09 ` Takashi Iwai
2014-09-23 14:46 ` Sudip Mukherjee [this message]
2014-09-23 11:00 ` [PATCH v4 3/5] ALSA: ctxfi: ctatc: added reference to snd_card Sudip Mukherjee
2014-09-23 11:00 ` [PATCH v4 4/5] ALSA: ctxfi: pr_* replaced with dev_* Sudip Mukherjee
2014-09-23 11:00 ` [PATCH v4 5/5] ALSA: ctxfi: sparse warning Sudip Mukherjee
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=20140923144644.GA19585@sudip-PC \
--to=sudipm.mukherjee@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tiwai@suse.de \
/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).