Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp2047319lqp; Tue, 16 Apr 2024 06:08:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWgrMZYxJPlUPN2Xi90GAi5YX5BNT8K22x4Mk+j6jfuzFNSBw26Vfd55R81DU1BsfXCC0H+Nzxv/6Q9TaKhyUe0yrSPdDx892zt12ahjA== X-Google-Smtp-Source: AGHT+IGLP0ZouquW04iCu997em00tjdLlCH0vj/4FqSSQtLNBclsMEODAQWOLSWtbs5oqgcLKEhg X-Received: by 2002:a17:90a:5145:b0:2a4:9441:13d3 with SMTP id k5-20020a17090a514500b002a4944113d3mr9845581pjm.12.1713272933818; Tue, 16 Apr 2024 06:08:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713272933; cv=pass; d=google.com; s=arc-20160816; b=jOWssihh6IJ+2Rh1TZYKLAjft4yJ6ZEfI0Dl8RpCT9MepjbtrHrqLhzY3Xbqyv4vwJ yXrr3HEvPjdSvpcUcLmnGVDtPxRv8GRRZUnC5DQIg42oudnVta1JMeMNwopQHC6F6TWO dCGIKv2UV+nMCNEx0VaTC7ZvbZrM9Q996KM9cF3A6f81bS2pH2TRSPqDZs0gtuE4IwLz 2tlqLT7vMrfcWiuIflY8zJQlBRo8d/8d0mfGftulvX1hWjMEyNHzyhcjtBbgIhDhYBYK ZZBH88/VDJYt4PkiDIqyRF+oWLrk3ByNeZkvokzVmT09bDPcVy9Sydwvtt4RA9ysVYJW rvDQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=nq1fU38+YbMXQbv6fuKYJYq/QSLMrZ0aemu44ZrNMOg=; fh=UAlP0tWVS1VUiTuieYB0+FkAEm6iJ8ONagIjk60unwM=; b=J+wXDq5M5hpAhMzJ3bN3IQFPFdd5Ohx+Ud2XBpifC++JBzi1BDv6nfoKuGHGFNUXxs ZlHl3VyTUANo7irKh6bf/IzkZabqresQJfFprYG2QnAtH55qgliduofM8CtdOo7SsETF 1hgtCUwL8d4gsN1n1RCDz3oUnsVfI64dca8jW7TRqA8RdTX1bN58kd/bkLO70pyVsEeb OOeOFUhKmxTl4HMN0s86PXN/ECLYfYMNukAHNk/GyITdepUH8YYtCQ9LMMVnQfsRY8Bb nCr8qZmuLMA6lH0AoxV+6LOpryt9lfJ8qz98etciwS5Ck20Hk69H5W/puJDiBJ04lyBK TQHw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@finest.io header.s=s1-ionos header.b=g92ogG9p; arc=pass (i=1 spf=pass spfdomain=finest.io dkim=pass dkdomain=finest.io); spf=pass (google.com: domain of linux-kernel+bounces-146835-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-146835-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id q22-20020a17090aa01600b002a28b5ee082si9924026pjp.140.2024.04.16.06.08.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 06:08:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-146835-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@finest.io header.s=s1-ionos header.b=g92ogG9p; arc=pass (i=1 spf=pass spfdomain=finest.io dkim=pass dkdomain=finest.io); spf=pass (google.com: domain of linux-kernel+bounces-146835-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-146835-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 406CC286616 for ; Tue, 16 Apr 2024 12:57:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9E3A712C547; Tue, 16 Apr 2024 12:56:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=finest.io header.i=parker@finest.io header.b="g92ogG9p" Received: from mout.perfora.net (mout.perfora.net [74.208.4.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BABBB12BF1D; Tue, 16 Apr 2024 12:56:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.208.4.197 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713272216; cv=none; b=bCTrg/4y7jSLA0zB1WZlXnYPBwQdTSKPh5y+tj9ttaG63fg915h5kMnCa/Js5VotOdAoWy54KQkozYTFvUSGpcXiE4nArVW2HRSTrKRDqU1HgZzbN6Lk485J4Al+XuSOcGCYIDa0yZKVn7tYkQ7fO14OP0XBJM4D9mwg6erl28A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713272216; c=relaxed/simple; bh=QjdcD+5gndgUXKknCUOuWGZOGbJGx9wFZpaqOHf8IXI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=h8rAlYLWhRGpMVqrnFFvxOmChmresY83giMvbtkH6g4nK1iPWbrxCLbXQ9W3kEGzuVPz6WxCusXfk3gZSZcXGNFtWbAf7jWtJHJaaSA0gP+NjtVV6NJaTqkejPSrZpMelRK4AGYHnpgz1jjVU6yttsqqnOayQCS1t6q1gW/Qa4w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=finest.io; spf=pass smtp.mailfrom=finest.io; dkim=pass (2048-bit key) header.d=finest.io header.i=parker@finest.io header.b=g92ogG9p; arc=none smtp.client-ip=74.208.4.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=finest.io Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=finest.io DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=finest.io; s=s1-ionos; t=1713272197; x=1713876997; i=parker@finest.io; bh=nq1fU38+YbMXQbv6fuKYJYq/QSLMrZ0aemu44ZrNMOg=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:Message-ID:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=g92ogG9pzZZl7fwWUUMWponggIrLl/pZr8Hflo99cbYyc/vafU4/FpJoKP8yuiG4 Rc3RCv6Dqpp8xwfNKgMla4t8gG9EwvP9KuNLNg8dZ5M786SbP3bSEXrnh/w30wAf0 fA/bdAagzGvRRm1/19P0BO2nqB5er9pb2WA0kTCxmPo8WSBJlZ1aoWr1Y26IwbOzD 2CyJtgNWmaRWLP1OdsnZOn8I3HLQguuLIk+ShMHmnMsW571af+4TCKDYtD5uf++qt BVdf+arrURUtQpGZf8lAuSpUz6h0JHaN7d9e4m3Jc9Hpc/atfg1E7wbwMJKfRlpRQ AbC1wsIwrQxpC40tyQ== X-UI-Sender-Class: 55c96926-9e95-11ee-ae09-1f7a4046a0f6 Received: from finest.io ([98.159.241.229]) by mrelay.perfora.net (mreueus002 [74.208.5.2]) with ESMTPSA (Nemesis) id 0MYQD9-1sIrpN48A5-00NDRM; Tue, 16 Apr 2024 14:56:37 +0200 From: Parker Newman To: Greg Kroah-Hartman , Jiri Slaby , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Cc: Parker Newman Subject: [PATCH v3 4/8] serial: exar: add optional board_init function Date: Tue, 16 Apr 2024 08:55:31 -0400 Message-ID: X-Mailer: git-send-email 2.43.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:Zc5YffDDEQWqNS9VJLFw2eg2+NrUU+PDgt9ChqVDh9Q/UVyvivJ /Cu4JP0BO+P6L7MS30AgR7uFWSP3erOLw1P4NKAh44NxMTIpOjxuJyQz+sgY9aCr7vrYsBU wPI9TwXlJ9ZjOL3gwKR9vVNf+iuCkdFwDEJTKYwRpnPcNaDUBXytE+oYkyi0lXDnaO4Xynr 9p0IwUBBmfNED8X5YYK5A== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:f8mxUc9XiuU=;PvwLdBSnRj94fQLN7Ku3b6I60gk 4ed2JOP0nQXpOoslOFKm4BzwcdQNqD0mC0pnwaQlrRuz9epsWVbAlKO32Kdqd7y/t5uTS9n0X Pkffuny3e8n3n7n7U4dfWbFbEKoNnhDS3gokFHgd2Gy3MnIuum2JWocnvNc5Eg7gWPwboYJcZ 8beh7kTuljqS7UfCviwKxcMRaalh1UhBKKxTEKff0R7iNgvehCN0yoiFCvLc5DePEMta19zAy m47pBEkgOTIJLTzxfp/s/WM5Th5Y5YzaOBBQTSP/kGt8lAY0ewFYnqWuARplTIan0MOJfegev Z34Me6AehVyB+zFuVJNEJWetuvgQ/K9AbuRRrgOPMOPKwN8hIEhhZwX4G0ula/l3S46e7OvBC hu9oyXcUynmtLmq7NbuBqg5X6PyI8CuyH839m5bYnPc1GHSmP1UIe9IPmfebeEYgyC0XJ+fBy 3nI7EtFMvk4C0f0yJVtDTRxAOEQ5D1qtaOovLTc66OhcEMDKxCeBXPu898reGQ8HjBLP2sKsN KiiI6b0HOCXmkF2kjaupN3W9FWjEHSJB+lxastOXnQzKOmiAk//rh2eMeFN1obNAHo6hslohD 0Rzz8ZlpVen3dEErNNBaj7jw5hatSbfBzUkuULwkVfvlWxnm7JFkt39mW0/iLx14+VMddDlmg P6Xjx7Xt6Jk8xi+7241PVW/h/3IL97uHuSORV4K2uFepbB0b6kg8gymG/dxQ3RcmPfjtG9jfz ul0P5dhE7z4qVcCtXzT3x2lgohT/in2ssnCpSbMyeLJDKM+rhFSCOs= From: Parker Newman - Add an optional "board_init()" function pointer to struct exar8250_board which is called once during probe prior to setting up the ports. - Fix several "missing identifier name" warnings from checkpatch in struct exar8250_platform and struct exar8250_board: WARNING: function definition argument should also have an identifier name - Fix warning from checkpatch: WARNING: please, no space before tabs + * 0^I^I2 ^IMode bit 0$ Changes in v3: - Renamed board_setup to board_init. - Changed pci_err to dev_err_probe - Added note above about checkpatch fixes Signed-off-by: Parker Newman =2D-- drivers/tty/serial/8250/8250_exar.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250= /8250_exar.c index 388dd60ad23a..cf7900bd2974 100644 =2D-- a/drivers/tty/serial/8250/8250_exar.c +++ b/drivers/tty/serial/8250/8250_exar.c @@ -133,7 +133,7 @@ * * MPIO Port Function * ---- ---- -------- - * 0 2 Mode bit 0 + * 0 2 Mode bit 0 * 1 2 Mode bit 1 * 2 2 Terminate bus * 3 - @@ -169,22 +169,24 @@ struct exar8250_platform { int (*rs485_config)(struct uart_port *port, struct ktermios *termios, struct serial_rs485 *rs485); const struct serial_rs485 *rs485_supported; - int (*register_gpio)(struct pci_dev *, struct uart_8250_port *); - void (*unregister_gpio)(struct uart_8250_port *); + int (*register_gpio)(struct pci_dev *pcidev, struct uart_8250_port *port= ); + void (*unregister_gpio)(struct uart_8250_port *port); }; /** * struct exar8250_board - board information * @num_ports: number of serial ports * @reg_shift: describes UART register mapping in PCI memory - * @setup: quirk run at ->probe() stage + * @board_init: quirk run once at ->probe() stage before setting up ports + * @setup: quirk run at ->probe() stage for each port * @exit: quirk run at ->remove() stage */ struct exar8250_board { unsigned int num_ports; unsigned int reg_shift; - int (*setup)(struct exar8250 *, struct pci_dev *, - struct uart_8250_port *, int); + int (*board_init)(struct exar8250 *priv); + int (*setup)(struct exar8250 *priv, struct pci_dev *pcidev, + struct uart_8250_port *port, int idx); void (*exit)(struct pci_dev *pcidev); }; @@ -772,6 +774,15 @@ exar_pci_probe(struct pci_dev *pcidev, const struct p= ci_device_id *ent) if (rc) return rc; + if (board->board_init) { + rc =3D board->board_init(priv); + if (rc) { + dev_err_probe(&pcidev->dev, rc, + "failed to init serial board\n"); + return rc; + } + } + for (i =3D 0; i < nr_ports && i < maxnr; i++) { rc =3D board->setup(priv, pcidev, &uart, i); if (rc) { =2D- 2.43.2