All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denys Vlasenko <dvlasenk@redhat.com>
To: Giuliano Pochini <pochini@shiny.it>, Takashi Iwai <tiwai@suse.de>,
	Jaroslav Kysela <perex@suse.cz>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Object code duplication in sound/pci/echoaudio/
Date: Mon, 11 May 2015 22:15:28 +0200	[thread overview]
Message-ID: <55510DE0.3080909@redhat.com> (raw)

There are fourteen files in sound/pci/echoaudio/, namely:

darla20.c darla24.c echo3g.c gina20.c gina24.c indigo.c
indigodj.c indigodjx.c indigoio.c indigoiox.c layla20.c
layla24.c mia.c mona.c

Which use the following method of "code reuse":

#include "echoaudio_dsp.c"
#include "echoaudio_gml.c"
#include "echoaudio.c"

echoaudio.c is not a header file, it contains a bunch of
static functions, some of a considerable size.
This makes those functions to be duplicated many times over.

For instance, there are fourteen instances of init_engine(),
each 1117 bytes long. Fourteen instances of pcm_open(), each 556 bytes
long.

11 get_firmware
10 free_firmware
13 audiopipe_free
14 init_hw
14 hw_rule_capture_format_by_channels
14 hw_rule_capture_channels_by_format
14 hw_rule_playback_format_by_channels
14 hw_rule_playback_channels_by_format

and so on.

In my humble opinion, this is not a good coding practice.
You should not duplicate functions like this.
Where possible, you need to reuse a single instance of a function.

According to git, author of these drivers is Giuliano Pochini
<pochini@shiny.it>.

             reply	other threads:[~2015-05-11 20:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-11 20:15 Denys Vlasenko [this message]
2015-05-14 20:32 ` Object code duplication in sound/pci/echoaudio/ Giuliano Pochini
2015-05-15 13:33   ` Denys Vlasenko
2015-05-18  8:55     ` Takashi Iwai
2015-05-19 23:05       ` Giuliano Pochini

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=55510DE0.3080909@redhat.com \
    --to=dvlasenk@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@suse.cz \
    --cc=pochini@shiny.it \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.