char: xillybus: Remove usage of 'pci_unmap_single()'

'struct xilly_mapping' includes a 'void *device' field which holds,
depending of the context, a 'struct device *' or a 'struct pci_dev *'.

This field is then used with 'pci_umap_single()' in 'xillybus_pcie.c' and
with 'dma_umap_single()' in 'xillybus_of.c'.

In order to remove usage of the deprecated 'pci_unmap_single()' API, turn
the 'void *device' field from 'struct xilly_mapping', into an explicit
'struct device *device' and use 'dma_umap_single()' everywhere.

In order to update 'xillybus_pcie.c', use the 'dev' field instead of the
'pdev' field from the 'struct xilly_endpoint'.
Both fields are initialized by 'xillybus_init_endpoint()' and in
'xillybus_pcie.c', we have:
	xillybus_init_endpoint(pdev, &pdev->dev, &pci_hw);
                                 ^       ^
        xilly_endpoint.pdev = ___|       |___ = xilly_endpoint.dev
So the modification from pci_ to dma_ function is straightforward.

While at it, remove a comment that is wrong, because in the case above,
both 'dev' and 'pdev' are not NULL.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/baa3f6c7f009d9c231ae320bf1d568268bfef089.1630083668.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Christophe JAILLET 2021-08-27 19:17:39 +02:00 коммит произвёл Greg Kroah-Hartman
Родитель b46f7d3309
Коммит 0b1eff5152
2 изменённых файлов: 4 добавлений и 8 удалений

Просмотреть файл

@ -87,10 +87,6 @@ struct xilly_channel {
};
struct xilly_endpoint {
/*
* One of pdev and dev is always NULL, and the other is a valid
* pointer, depending on the type of device
*/
struct pci_dev *pdev;
struct device *dev;
struct xilly_endpoint_hardware *ephw;
@ -131,7 +127,7 @@ struct xilly_endpoint_hardware {
};
struct xilly_mapping {
void *device;
struct device *device;
dma_addr_t dma_addr;
size_t size;
int direction;

Просмотреть файл

@ -69,8 +69,8 @@ static void xilly_pci_unmap(void *ptr)
{
struct xilly_mapping *data = ptr;
pci_unmap_single(data->device, data->dma_addr,
data->size, data->direction);
dma_unmap_single(data->device, data->dma_addr, data->size,
data->direction);
kfree(ptr);
}
@ -105,7 +105,7 @@ static int xilly_map_single_pci(struct xilly_endpoint *ep,
return -ENODEV;
}
this->device = ep->pdev;
this->device = ep->dev;
this->dma_addr = addr;
this->size = size;
this->direction = pci_direction;