lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 18 Sep 2012 12:27:31 +0530
From:	viresh kumar <viresh.kumar@...aro.org>
To:	Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc:	Vinod Koul <vinod.koul@...el.com>, spear-devel@...t.st.com,
	linux-kernel@...r.kernel.org, Hein Tibosch <hein_tibosch@...oo.es>
Subject: Re: [PATCH 4/7] dw_dmac: autoconfigure block_size or use platform data

On Mon, Sep 17, 2012 at 1:09 PM, Andy Shevchenko
<andriy.shevchenko@...ux.intel.com> wrote:
> @@ -1380,6 +1370,7 @@ static int __devinit dw_probe(struct platform_device *pdev)
>         bool                    autocfg;
>         unsigned int            dw_params;
>         unsigned int            nr_channels;
> +       unsigned int            max_blk_size;
>         int                     irq;
>         int                     err;
>         int                     i;
> @@ -1420,6 +1411,9 @@ static int __devinit dw_probe(struct platform_device *pdev)
>
>         dw->regs = regs;
>
> +       /* get hardware configuration parameters */
> +       max_blk_size = dma_readl(dw, MAX_BLK_SIZE);
> +

Do this only for autocfg case.

>         /* Calculate all channel mask before DMA setup */
>         dw->all_chan_mask = (1 << nr_channels) - 1;
>
> @@ -1465,6 +1459,14 @@ static int __devinit dw_probe(struct platform_device *pdev)
>                 INIT_LIST_HEAD(&dwc->free_list);
>
>                 channel_clear_bit(dw, CH_EN, dwc->mask);
> +
> +               /* hardware configuration */
> +               if (autocfg) {
> +                       dwc->block_size =
> +                               (4 << ((max_blk_size >> 4 * i) & 0xf)) - 1;

Put a comment on what are you doing here.

> +               } else {
> +                       dwc->block_size = pdata->block_size;
> +               }

Don't need {} for single line statements.

>         }
>
>         /* Clear all interrupts on all channels. */
> diff --git a/drivers/dma/dw_dmac_regs.h b/drivers/dma/dw_dmac_regs.h
> index 0f96965..233f5e5 100644
> --- a/drivers/dma/dw_dmac_regs.h
> +++ b/drivers/dma/dw_dmac_regs.h
> @@ -186,6 +186,9 @@ struct dw_dma_chan {
>
>         unsigned int            descs_allocated;
>
> +       /* hardware configuration */
> +       unsigned short          block_size;
> +

You actually don't save any memory here with short and actually makes access
to block_size more complex. keeping it int would be better i believe.

viresh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ