From: Sergei Shtylyov <sshtylyov@mvista.com>
To: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] libata: reduce ata_pci_[sff,bmdma]_init_one() size
Date: Wed, 09 Feb 2011 23:08:31 +0300 [thread overview]
Message-ID: <4D52F43F.5040507@ru.mvista.com> (raw)
In-Reply-To: <201102091515.22677.bzolnier@gmail.com>
Hello.
Bartlomiej Zolnierkiewicz wrote:
> Turn both helpers (which are used only during LLDs initialization
> time and thus are not performance sensitive) into wrappers around
> the new ata_pci_init_one() function, this cuts 20 LOC and saves
> ~1.1k of the output code size (x86-64):
> text data bss dec hex filename
> 21392 0 19 21411 53a3 drivers/ata/libata-sff.o.before
> 20256 0 19 20275 4f33 drivers/ata/libata-sff.o.after
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> ---
> drivers/ata/libata-sff.c | 112 +++++++++++++++++++----------------------------
> 1 file changed, 46 insertions(+), 66 deletions(-)
> Index: b/drivers/ata/libata-sff.c
> ===================================================================
> --- a/drivers/ata/libata-sff.c
> +++ b/drivers/ata/libata-sff.c
[...]
> @@ -2538,14 +2517,22 @@ int ata_pci_sff_init_one(struct pci_dev
> if (rc)
> goto out;
>
> - /* prepare and activate SFF host */
> - rc = ata_pci_sff_prepare_host(pdev, ppi, &host);
> + if (bmdma)
> + /* prepare and activate BMDMA host */
> + rc = ata_pci_bmdma_prepare_host(pdev, ppi, &host);
> + else
> + /* prepare and activate SFF host */
> + rc = ata_pci_sff_prepare_host(pdev, ppi, &host);
> if (rc)
> goto out;
> host->private_data = host_priv;
> - host->flags |= hflag;
> + host->flags |= hflags;
>
> - rc = ata_pci_sff_activate_host(host, ata_sff_interrupt, sht);
> + if (bmdma) {
> + pci_set_master(pdev);
> + rc = ata_pci_sff_activate_host(host, ata_bmdma_interrupt, sht);
> + } else
> + rc = ata_pci_sff_activate_host(host, ata_sff_interrupt, sht);
Perhaps this will save even more:
if (bmdma)
pci_set_master(pdev);
rc = ata_pci_sff_activate_host(host, bmdma ? ata_bmdma_interrupt :
ata_sff_interrupt, sht);
> @@ -2554,6 +2541,35 @@ out:
>
> return rc;
> }
> +
> +/**
> + * ata_pci_sff_init_one - Initialize/register PIO-only PCI IDE controller
> + * @pdev: Controller to be initialized
> + * @ppi: array of port_info, must be enough for two ports
> + * @sht: scsi_host_template to use when registering the host
> + * @host_priv: host private_data
> + * @hflag: host flags
> + *
> + * This is a helper function which can be called from a driver's
> + * xxx_init_one() probe function if the hardware uses traditional
> + * IDE taskfile registers and is PIO only.
> + *
> + * ASSUMPTION:
> + * Nobody makes a single channel controller that appears solely as
> + * the secondary legacy port on PCI.
> + *
> + * LOCKING:
> + * Inherited from PCI layer (may sleep).
> + *
> + * RETURNS:
> + * Zero on success, negative on errno-based value on error.
> + */
> +int ata_pci_sff_init_one(struct pci_dev *pdev,
> + const struct ata_port_info * const *ppi,
> + struct scsi_host_template *sht, void *host_priv, int hflag)
s/hflag/hflags/ for consistency?
> +{
> + return ata_pci_init_one(pdev, ppi, sht, host_priv, hflag, 0);
s/0/false/?
> +}
> EXPORT_SYMBOL_GPL(ata_pci_sff_init_one);
>
> #endif /* CONFIG_PCI */
> @@ -3272,43 +3288,7 @@ int ata_pci_bmdma_init_one(struct pci_de
> struct scsi_host_template *sht, void *host_priv,
> int hflags)
> {
[...]
> + return ata_pci_init_one(pdev, ppi, sht, host_priv, hflags, 1);
s/1/true/?
WBR, Sergei
next prev parent reply other threads:[~2011-02-09 20:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-09 14:15 [PATCH] libata: reduce ata_pci_[sff,bmdma]_init_one() size Bartlomiej Zolnierkiewicz
2011-02-09 20:08 ` Sergei Shtylyov [this message]
2011-02-09 21:17 ` Alan Cox
-- strict thread matches above, loose matches on Subject: below --
2011-10-11 17:22 Bartlomiej Zolnierkiewicz
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=4D52F43F.5040507@ru.mvista.com \
--to=sshtylyov@mvista.com \
--cc=bzolnier@gmail.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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.