Re: [PATCH] tty/synclink: remove leftover bits of non-PCI card support

From: Jiri Slaby
Date: Tue Jul 28 2020 - 02:05:50 EST


On 27. 07. 20, 15:05, Christoph Hellwig wrote:
> Since commit 1355cba9c3ba ("tty/synclink: remove ISA support"), the
> synlink driver only supports PCI card. Remove any leftover dead code
> to support other cards.

So now you can remove also the defines and bus_type completely:
$ git grep -E 'MGSL_BUS_TYPE_(E?ISA|PCI)'
drivers/tty/synclink_gt.c: info->bus_type = MGSL_BUS_TYPE_PCI;
drivers/tty/synclinkmp.c: info->bus_type = MGSL_BUS_TYPE_PCI;
include/uapi/linux/synclink.h:#define MGSL_BUS_TYPE_ISA 1
include/uapi/linux/synclink.h:#define MGSL_BUS_TYPE_EISA 2
include/uapi/linux/synclink.h:#define MGSL_BUS_TYPE_PCI 5

$ git grep -w bus_type drivers/tty/synclink*
drivers/tty/synclink_gt.c: unsigned int bus_type;
drivers/tty/synclink_gt.c: info->bus_type = MGSL_BUS_TYPE_PCI;
drivers/tty/synclinkmp.c: unsigned int bus_type;
/* expansion bus type (ISA,EISA,PCI) */
drivers/tty/synclinkmp.c: info->bus_type = MGSL_BUS_TYPE_PCI;

> --- a/drivers/tty/synclink.c
> +++ b/drivers/tty/synclink.c
...
> @@ -4040,58 +3977,40 @@ static int mgsl_claim_resources(struct mgsl_struct *info)
...
> - } else {
> - /* claim DMA channel */
> + if ( !mgsl_memory_test(info) ) {
> + printk( "%s(%d):Failed shared memory test %s MemAddr=%08X\n",
> + __FILE__,__LINE__,info->device_name, info->phys_memory_base );
> + goto errout;
> + }
>
> - if (request_dma(info->dma_level,info->device_name) < 0){
> - printk( "%s(%d):Can't request DMA channel on device %s DMA=%d\n",
> - __FILE__,__LINE__,info->device_name, info->dma_level );
> - goto errout;
> - }
> - info->dma_requested = true;
> -
> - /* ISA adapter uses bus master DMA */
> - set_dma_mode(info->dma_level,DMA_MODE_CASCADE);
> - enable_dma(info->dma_level);
> + info->lcr_base = ioremap(info->phys_lcr_base, PAGE_SIZE);
> + if (!info->lcr_base) {
> + printk( "%s(%d):Can't map LCR memory on device %s MemAddr=%08X\n",
> + __FILE__,__LINE__,info->device_name, info->phys_lcr_base );
> + goto errout;
> }
> -
> + info->lcr_base += info->lcr_offset;
> +

Could you fix up the whitespace git show warns about (git show outputs
red background, if you use colors). Like this one? It looks like you
added one more \t on an empty line here.

> if ( mgsl_allocate_dma_buffers(info) < 0 ) {
> printk( "%s(%d):Can't allocate DMA buffers on device %s DMA=%d\n",
> __FILE__,__LINE__,info->device_name, info->dma_level );
> @@ -4200,16 +4119,10 @@ static void mgsl_add_device( struct mgsl_struct *info )
> else if ( info->max_frame_size > 65535 )
> info->max_frame_size = 65535;
>
> - if ( info->bus_type == MGSL_BUS_TYPE_PCI ) {
> - printk( "SyncLink PCI v%d %s: IO=%04X IRQ=%d Mem=%08X,%08X MaxFrameSize=%u\n",
> - info->hw_version + 1, info->device_name, info->io_base, info->irq_level,
> - info->phys_memory_base, info->phys_lcr_base,
> - info->max_frame_size );
> - } else {
> - printk( "SyncLink ISA %s: IO=%04X IRQ=%d DMA=%d MaxFrameSize=%u\n",
> - info->device_name, info->io_base, info->irq_level, info->dma_level,
> - info->max_frame_size );
> - }
> + printk( "SyncLink PCI v%d %s: IO=%04X IRQ=%d Mem=%08X,%08X MaxFrameSize=%u\n",
> + info->hw_version + 1, info->device_name, info->io_base, info->irq_level,
> + info->phys_memory_base, info->phys_lcr_base,
> + info->max_frame_size );

Or here, there is \t, 4 spaces and \t again.

thanks,
--
js