Re: [PATCH V9 1/4] dma-mapping: Rework dma_get_cache_alignment()

From: éåæ
Date: Mon Nov 13 2017 - 03:37:31 EST


But in b44_init(), there is no device instances.



------------------ Original ------------------
From: "Christoph Hellwig"<hch@xxxxxx>;
Date: Fri, Nov 10, 2017 08:30 PM
To: "Huacai Chen"<chenhc@xxxxxxxxxx>;
Cc: "Christoph Hellwig"<hch@xxxxxx>; "Marek Szyprowski"<m.szyprowski@xxxxxxxxxxx>; "Robin Murphy"<robin.murphy@xxxxxxx>; "Andrew Morton"<akpm@xxxxxxxxxxxxxxxxxxxx>; "Fuxin Zhang"<zhangfx@xxxxxxxxxx>; "linux-kernel"<linux-kernel@xxxxxxxxxxxxxxx>; "Ralf Baechle"<ralf@xxxxxxxxxxxxxx>; "James Hogan"<james.hogan@xxxxxxxxxx>; "linux-mips"<linux-mips@xxxxxxxxxxxxxx>; "James E . J . Bottomley"<jejb@xxxxxxxxxxxxxxxxxx>; "Martin K . Petersen"<martin.petersen@xxxxxxxxxx>; "linux-scsi"<linux-scsi@xxxxxxxxxxxxxxx>; "stable"<stable@xxxxxxxxxxxxxxx>; "Michael S . Tsirkin"<mst@xxxxxxxxxx>; "Pawel Osciak"<pawel@xxxxxxxxxx>; "Kyungmin Park"<kyungmin.park@xxxxxxxxxxx>; "Michael Chan"<michael.chan@xxxxxxxxxxxx>; "Benjamin Herrenschmidt"<benh@xxxxxxxxxxxxxxxxxxx>; "Ivan Mikhaylov"<ivan@xxxxxxxxxx>; "Tariq Toukan"<tariqt@xxxxxxxxxxxx>; "Andy Gross"<agross@xxxxxxxxxxxxxx>; "Mark A . Greer"<mgreer@xxxxxxxxxxxxxxx>; "Robert Baldyga"<r.baldyga@xxxxxxxxxxxxx>;
Subject: Re: [PATCH V9 1/4] dma-mapping: Rework dma_get_cache_alignment()


> diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c
> index a1125d1..2f6ffe5 100644
> --- a/drivers/net/ethernet/broadcom/b44.c
> +++ b/drivers/net/ethernet/broadcom/b44.c
> @@ -2344,6 +2344,10 @@ static int b44_init_one(struct ssb_device *sdev,
> struct net_device *dev;
> struct b44 *bp;
> int err;
> + unsigned int dma_desc_align_size = dma_get_cache_alignment(sdev->dma_dev);
> +
> + /* Setup paramaters for syncing RX/TX DMA descriptors */
> + dma_desc_sync_size = max_t(unsigned int, dma_desc_align_size, sizeof(struct dma_desc));
>
> instance++;
>
> @@ -2587,12 +2591,8 @@ static inline void b44_pci_exit(void)
>
> static int __init b44_init(void)
> {
> - unsigned int dma_desc_align_size = dma_get_cache_alignment();
> int err;
>
> - /* Setup paramaters for syncing RX/TX DMA descriptors */
> - dma_desc_sync_size = max_t(unsigned int, dma_desc_align_size, sizeof(struct dma_desc));
> -

This looks wrong - you override a global variable for each probed
device.