parport_pc: Let chipset drivers mask unsupported modes
Rename `parport_pc_probe_port' to `__parport_pc_probe_port' and add a `mode_mask' parameter so that callers can specify a mask of unsupported modes to exclude even if mode probing seems to indicate otherwise. Add a `parport_pc_probe_port' wrapper with an implicit mask of 0 for the current callers to use. No functional change at this point, but the configuration of data write handlers is now no longer intertwined with determination and reporting of available modes. Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk> Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com> Link: https://lore.kernel.org/r/20230108215656.6433-2-sudipm.mukherjee@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
1c4b7d967e
commit
f01dda1cb8
@ -2000,11 +2000,12 @@ static int parport_dma_probe(struct parport *p)
|
||||
static LIST_HEAD(ports_list);
|
||||
static DEFINE_SPINLOCK(ports_lock);
|
||||
|
||||
struct parport *parport_pc_probe_port(unsigned long int base,
|
||||
unsigned long int base_hi,
|
||||
int irq, int dma,
|
||||
struct device *dev,
|
||||
int irqflags)
|
||||
static struct parport *__parport_pc_probe_port(unsigned long int base,
|
||||
unsigned long int base_hi,
|
||||
int irq, int dma,
|
||||
struct device *dev,
|
||||
int irqflags,
|
||||
unsigned int mode_mask)
|
||||
{
|
||||
struct parport_pc_private *priv;
|
||||
struct parport_operations *ops;
|
||||
@ -2116,20 +2117,30 @@ struct parport *parport_pc_probe_port(unsigned long int base,
|
||||
p->dma != PARPORT_DMA_NOFIFO &&
|
||||
priv->fifo_depth > 0 && p->irq != PARPORT_IRQ_NONE) {
|
||||
p->modes |= PARPORT_MODE_ECP | PARPORT_MODE_COMPAT;
|
||||
p->ops->compat_write_data = parport_pc_compat_write_block_pio;
|
||||
#ifdef CONFIG_PARPORT_1284
|
||||
p->ops->ecp_write_data = parport_pc_ecp_write_block_pio;
|
||||
#endif /* IEEE 1284 support */
|
||||
if (p->dma != PARPORT_DMA_NONE) {
|
||||
pr_cont(", dma %d", p->dma);
|
||||
if (p->dma != PARPORT_DMA_NONE)
|
||||
p->modes |= PARPORT_MODE_DMA;
|
||||
} else
|
||||
pr_cont(", using FIFO");
|
||||
} else
|
||||
/* We can't use the DMA channel after all. */
|
||||
p->dma = PARPORT_DMA_NONE;
|
||||
#endif /* Allowed to use FIFO/DMA */
|
||||
|
||||
p->modes &= ~mode_mask;
|
||||
|
||||
#ifdef CONFIG_PARPORT_PC_FIFO
|
||||
if ((p->modes & PARPORT_MODE_COMPAT) != 0)
|
||||
p->ops->compat_write_data = parport_pc_compat_write_block_pio;
|
||||
#ifdef CONFIG_PARPORT_1284
|
||||
if ((p->modes & PARPORT_MODE_ECP) != 0)
|
||||
p->ops->ecp_write_data = parport_pc_ecp_write_block_pio;
|
||||
#endif
|
||||
if ((p->modes & (PARPORT_MODE_ECP | PARPORT_MODE_COMPAT)) != 0) {
|
||||
if ((p->modes & PARPORT_MODE_DMA) != 0)
|
||||
pr_cont(", dma %d", p->dma);
|
||||
else
|
||||
pr_cont(", using FIFO");
|
||||
}
|
||||
#endif /* Allowed to use FIFO/DMA */
|
||||
|
||||
pr_cont(" [");
|
||||
|
||||
#define printmode(x) \
|
||||
@ -2237,6 +2248,16 @@ out1:
|
||||
platform_device_unregister(pdev);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct parport *parport_pc_probe_port(unsigned long int base,
|
||||
unsigned long int base_hi,
|
||||
int irq, int dma,
|
||||
struct device *dev,
|
||||
int irqflags)
|
||||
{
|
||||
return __parport_pc_probe_port(base, base_hi, irq, dma,
|
||||
dev, irqflags, 0);
|
||||
}
|
||||
EXPORT_SYMBOL(parport_pc_probe_port);
|
||||
|
||||
void parport_pc_unregister_port(struct parport *p)
|
||||
|
Loading…
Reference in New Issue
Block a user