Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp5395839rwl; Sun, 8 Jan 2023 14:28:08 -0800 (PST) X-Google-Smtp-Source: AMrXdXuCV2n2vbC0a9hABLxmezgR9xIdgun8WhzzoKxKviD4djmkAxRMWv+XRYPzmDZJKTsA7fGq X-Received: by 2002:a17:906:2857:b0:7c1:8f53:83a0 with SMTP id s23-20020a170906285700b007c18f5383a0mr49453421ejc.13.1673216888490; Sun, 08 Jan 2023 14:28:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673216888; cv=none; d=google.com; s=arc-20160816; b=vXiswkQ5KnttckWvYGWPOTGyJFf3tHVLpko3lp481Xy7YIcGy3GrzntEBNLvs3JvNX jai0qZjpH1BPx38zGk7dCXurXA5uRJKEDJeurPw2YwfEWZO2mctRJpXU2eCBTPtUjxZP gAocHrv9GT8g+euHjKaxQ5WO9AkkM2RdMIloaLmafpwBDgiwQm7MgjtFxw7vyzJzofZN RPMP6Qklenb2C57bJ75IPD2BFsJN/lFWLyr+gRLxR46eakUhZrlVTa8Gn85D0iRJY6MD huSE4iuAaRzO+zTj9IV6LYrUL/AIFTxtaNljjCV1SjSG0J6hbhNBoALzN3xAQDn4eaDw gGnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=PuHjicZYsZv1YxafD0PitIxhFzu7w+N5/HlaM8PLcI4=; b=U8E5XTYTAa5CrZrEAm1GozTrNR3PtjZ81A6c9t1l+mzO2WXMyO1kmbP4VCxCY0DZ+1 QAoQT11pOwvmQ/LIiNeHc4pyOSU6FOvh8GEGvguOCKhPdsCeyp9NovEzWwGBcrlMnjbB gvEkzkaBM3ZIl1PtJFy5jOc6oXWRc6f17ZSqt9ayNT1oYA57cVG49x3RIUpIP1ko4wxM bMsG3yUdXVrd6FZ+qhAnKrsJoUcPMbI3eP775dn2HvUD1acmh3mWbCUhxCCIhvKuzMv5 pH/5+ui7ezMBYGXH3NxS0mfxBmhalj2D/rTkvO4zeRjx/6rm6tH+/T7oGCcxQDRnQ3UO 2kFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ldezYofx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cr16-20020a170906d55000b0084d3bf44987si3272284ejc.551.2023.01.08.14.27.50; Sun, 08 Jan 2023 14:28:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ldezYofx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236260AbjAHV5N (ORCPT + 51 others); Sun, 8 Jan 2023 16:57:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236219AbjAHV5J (ORCPT ); Sun, 8 Jan 2023 16:57:09 -0500 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2285B7677 for ; Sun, 8 Jan 2023 13:57:08 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id k22-20020a05600c1c9600b003d1ee3a6289so5241699wms.2 for ; Sun, 08 Jan 2023 13:57:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PuHjicZYsZv1YxafD0PitIxhFzu7w+N5/HlaM8PLcI4=; b=ldezYofxF0jJjJeJC1RD3qkb4zEl0FmqQ0EzLX/Nkhv7NxXSNNuTeZx31gd9ZYfA9t YXnoXkg4aiNaDbUAOFjZ2a166mwOtET4tc5l0zf9nl97m3RqWI9/NqTjxyJNMWoXdiC1 G7d07sdLjN0QUk221voWKI1iZntHD7Yr1vj+jnnIvKGQPu4jBRnp0DW/uxYzMpKjlvWB pzCRMO0Zu1Ok0opQ8rJFJoVkih8W51eiuzIzpn3RFUc9297YdFG1oUh0f8AKtXi1+CrO clVWqODs4HTpr+0d+eyFk+EofoizImSSPjhwnyCZE6yWu/ge9KhR90Jd1vQwRwmGeape tKbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PuHjicZYsZv1YxafD0PitIxhFzu7w+N5/HlaM8PLcI4=; b=DZaL1Nev9UCpC1a6zfgIKI67l7ery4TOMascHT6TEKKo99B18ZveVP/K0fYFQ8S6b6 /yKj58+9slVW6hXFW6abvbOJORZuNUGi3wpBuBPkcoBdbvRkvJ7mQEsJjYytb7ug1jR4 mwQ1AAy6i3QYd11/IeKjdacEHaiyT+jdZ2xkeHzuogr30Kh2Jr7U3ZFWJ83LcImjfnpB B3F0Uod6lJUBPW6dZ72LIzOhQy3VCgX634IrzyaQwYYLuF2x99wRWRU+wjO3Qi9yDuKc rNyX3S8RT7LgoTucwhP+8QFS827QwJIxAtCFm99+6ZgauuxG1tRmDXwBxo7NCm6/GNeh cS/w== X-Gm-Message-State: AFqh2kp3HXOg1FNvboGbeq7A9YzD6FO9Zkz4KaSs3Wq9mT2ibiq560rY F9ip0+1aR5nrZuSzS5ipYXs= X-Received: by 2002:a05:600c:2247:b0:3d3:4b1a:6ff9 with SMTP id a7-20020a05600c224700b003d34b1a6ff9mr45128622wmm.26.1673215026538; Sun, 08 Jan 2023 13:57:06 -0800 (PST) Received: from localhost.localdomain ([2a10:d582:3bb:0:63f8:f640:f53e:dd47]) by smtp.gmail.com with ESMTPSA id h15-20020a05600c314f00b003d99469ece1sm14654071wmo.24.2023.01.08.13.57.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Jan 2023 13:57:06 -0800 (PST) From: Sudip Mukherjee To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, "Maciej W. Rozycki" , Sudip Mukherjee Subject: [PATCH 2/7] parport_pc: Let chipset drivers mask unsupported modes Date: Sun, 8 Jan 2023 21:56:51 +0000 Message-Id: <20230108215656.6433-2-sudipm.mukherjee@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230108215656.6433-1-sudipm.mukherjee@gmail.com> References: <20230108215656.6433-1-sudipm.mukherjee@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Maciej W. Rozycki" 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 Signed-off-by: Sudip Mukherjee --- drivers/parport/parport_pc.c | 45 ++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c index de7afbea96cd..9daaaaa305e6 100644 --- a/drivers/parport/parport_pc.c +++ b/drivers/parport/parport_pc.c @@ -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,18 +2117,28 @@ 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; + if (p->dma != PARPORT_DMA_NONE) + p->modes |= PARPORT_MODE_DMA; + } 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 /* IEEE 1284 support */ - if (p->dma != PARPORT_DMA_NONE) { +#endif + if ((p->modes & (PARPORT_MODE_ECP | PARPORT_MODE_COMPAT)) != 0) { + if ((p->modes & PARPORT_MODE_DMA) != 0) pr_cont(", dma %d", p->dma); - p->modes |= PARPORT_MODE_DMA; - } else + 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 */ pr_cont(" ["); @@ -2237,6 +2248,16 @@ do { \ 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) -- 2.30.2