From patchwork Fri Jan 24 16:10:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 859735 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) (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 BCB4F189B83; Fri, 24 Jan 2025 16:15:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737735344; cv=none; b=jjRZMcIk5JNnSW/sCCYRez1EfDUd96RpgY4CBgcq8GVZ/dLmz6xQ3blgDrlx1LibpT3LxeKTzL8f1/+WywZoOkxPppekWdanNXnelH/rpBvg74C5C6KeIFg8pgKtxe7bcrayXnNENVa3z0WO+S5LYWFYBM8tiO57O+EQFcMZBtE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737735344; c=relaxed/simple; bh=wasJGmB1EUv6O1UP8Zj6E42g8sSkse/lhLFsfPwH8gA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JhXrJLFNUdVSC1lhk5ILTB/WH4carbX69q7hIl6XjJNrwCxV3JjVHkQYMw6Nb6gifRr1PD+gI7CaCRb4cf9BlIDwBCR/ZrcO8oP/gcDC09oTmpz574Ns6FmDVmAI63aoXAV3eS3N3v6iRbTZrwwCJ2SAEeYaClm25bkW3VHPNE8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=BITJUGo/; arc=none smtp.client-ip=198.175.65.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="BITJUGo/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1737735343; x=1769271343; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=wasJGmB1EUv6O1UP8Zj6E42g8sSkse/lhLFsfPwH8gA=; b=BITJUGo/gUkSemlouzdldgWwI+LsO8MU4lFd2eJ+cl1fFMbLbayIXQ20 cxmHu4vNNDoZsms/JtUR6pmIT1V93fRG2Qd64BeOvyw+6SPlgDoLvY53r OYnbgqMoUbcg+3GCREeKfQXschxM3PZb+6jBHMmB6BVtsSexYHAGYYsw+ KwH7URM44oCC7oemrtTKuJJXKTkteN6TwE87bujhLUf4P25I/jXfGNgkK 5VAiU5b6Mk8UqQvG1lnVKfrvQWnbNnAuQeeIAKg67yxG6OcyoBtrMx0vU tJh4oY5+RJtMEww81MPs+PqCQtwEBIEb4wdYUCzMr9byYs2XMe14Xuefw g==; X-CSE-ConnectionGUID: XKQ1gZTQTSy6G2rTO3iBFQ== X-CSE-MsgGUID: 42l4fYz/REiful0jWSjmcg== X-IronPort-AV: E=McAfee;i="6700,10204,11325"; a="38152887" X-IronPort-AV: E=Sophos;i="6.13,231,1732608000"; d="scan'208";a="38152887" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2025 08:15:41 -0800 X-CSE-ConnectionGUID: Xw8K7ejYQ9KyI/H34B5VAQ== X-CSE-MsgGUID: sfpIvmzaQbKCD95lTIobqQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.13,231,1732608000"; d="scan'208";a="107612354" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa006.fm.intel.com with ESMTP; 24 Jan 2025 08:15:39 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id A2D93164; Fri, 24 Jan 2025 18:15:37 +0200 (EET) From: Andy Shevchenko To: Greg Kroah-Hartman , Andy Shevchenko , Guanbing Huang , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Cc: Jiri Slaby Subject: [PATCH v1 1/6] serial: port: Assign ->iotype correctly when ->iobase is set Date: Fri, 24 Jan 2025 18:10:46 +0200 Message-ID: <20250124161530.398361-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20250124161530.398361-1-andriy.shevchenko@linux.intel.com> References: <20250124161530.398361-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-serial@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Currently the ->iotype is always assigned to the UPIO_MEM when the respective property is not found. However, this will not support the cases when user wants to have UPIO_PORT to be set or preserved. Support this scenario by checking ->iobase value and default the ->iotype respectively. Fixes: 1117a6fdc7c1 ("serial: 8250_of: Switch to use uart_read_port_properties()") Fixes: e894b6005dce ("serial: port: Introduce a common helper to read properties") Signed-off-by: Andy Shevchenko --- drivers/tty/serial/serial_port.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/serial_port.c b/drivers/tty/serial/serial_port.c index d35f1d24156c..f28d0633fe6b 100644 --- a/drivers/tty/serial/serial_port.c +++ b/drivers/tty/serial/serial_port.c @@ -173,6 +173,7 @@ EXPORT_SYMBOL(uart_remove_one_port); * The caller is responsible to initialize the following fields of the @port * ->dev (must be valid) * ->flags + * ->iobase * ->mapbase * ->mapsize * ->regshift (if @use_defaults is false) @@ -214,7 +215,7 @@ static int __uart_read_properties(struct uart_port *port, bool use_defaults) /* Read the registers I/O access type (default: MMIO 8-bit) */ ret = device_property_read_u32(dev, "reg-io-width", &value); if (ret) { - port->iotype = UPIO_MEM; + port->iotype = port->iobase ? UPIO_PORT : UPIO_MEM; } else { switch (value) { case 1: From patchwork Fri Jan 24 16:10:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 859734 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (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 3212B18EFCC; Fri, 24 Jan 2025 16:15:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737735344; cv=none; b=nVuJGQ98feHxuuRHi1xYa9l8m+oIC7TwN9ajkF4X+/vkhU0ozJVOSaZskVLBtUBgqqm2Ey38FyfQu3EXqadD2jfdWyxw8vMjwE1DwdEKkca5fhsKKppDxS1aYue7iSv1Wj1HbHWHWPIbYXfmxt+7SvKgZ8+QZy3WrsGNr3l9soo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737735344; c=relaxed/simple; bh=bOqQp5iiDR5OhNeYoMcyqcEXriZiM/TUsJ5hvzAd7R8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=k65tBSkVFT0DRv3eqoE7kUcytoJu2T7DCpKgA+GF1Z4odSqE4UrXK3KDXG5qY1mUXfoDXtGXOlZaFylYG+HMu9ucJ8wj7PKNBfOec+E+bhm5Sf0EB0oDRfudgsc1O1KW3FTIcmlkPKWqg4oNzRYcw3ql6HRqtAp6oHyHBSWaL1g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=HBm1NU/3; arc=none smtp.client-ip=192.198.163.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="HBm1NU/3" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1737735343; x=1769271343; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bOqQp5iiDR5OhNeYoMcyqcEXriZiM/TUsJ5hvzAd7R8=; b=HBm1NU/3v5qyITGSotCRUzUytXK5OajKpLODdFu0Nfw60TxOb8WuKYSJ EONc0skGw8bhnaf3ZO1Vnq33sUIYBFmr8meOtphWIcMB0OjTY6S3sGVhh Eu/+HE2yVi1hw3BT/jhYNJC0nyOc0/+lnhzfPv/FkNDhEuOqOmUBfsjY1 zaVtekac8E+1jJqt5HCdhLdSgs2t14y50Dy3th172CSo0MFkBdy/gSO+s XvTbj9vYDhQ4i5AI8CTflTf18drCR7UjdIg1Syg2GQ6rnA9sJE1dPRHu3 NGcE/NkgIuHCuF94HbV2VKIQatyzO2k6Ew9fi80pSz+yRCuL0q6vE4t1z g==; X-CSE-ConnectionGUID: 87spPD/ZRNut5DD8oXRi2g== X-CSE-MsgGUID: zcurAo/bRfW9udnPBdYWpg== X-IronPort-AV: E=McAfee;i="6700,10204,11325"; a="48858236" X-IronPort-AV: E=Sophos;i="6.13,231,1732608000"; d="scan'208";a="48858236" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2025 08:15:43 -0800 X-CSE-ConnectionGUID: IO3tEVMJSCa/FEvjSZFwKA== X-CSE-MsgGUID: T5Q2yqycR2qkYqnxNoRmDw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="107659135" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa010.jf.intel.com with ESMTP; 24 Jan 2025 08:15:41 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id CC2BE1E9; Fri, 24 Jan 2025 18:15:37 +0200 (EET) From: Andy Shevchenko To: Greg Kroah-Hartman , Andy Shevchenko , Guanbing Huang , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Cc: Jiri Slaby Subject: [PATCH v1 5/6] serial: 8250_platform: Remove unneeded ->iotype assignment Date: Fri, 24 Jan 2025 18:10:50 +0200 Message-ID: <20250124161530.398361-6-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20250124161530.398361-1-andriy.shevchenko@linux.intel.com> References: <20250124161530.398361-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-serial@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 If ->iobase is set the default will be UPIO_PORT for ->iotype after the uart_read_and_validate_port_properties() call. Hence no need to assign that explicitly. Otherwise it will be UPIO_MEM. Signed-off-by: Andy Shevchenko --- drivers/tty/serial/8250/8250_platform.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/tty/serial/8250/8250_platform.c b/drivers/tty/serial/8250/8250_platform.c index 348b7fa2e94d..d8cbd8d87b0e 100644 --- a/drivers/tty/serial/8250/8250_platform.c +++ b/drivers/tty/serial/8250/8250_platform.c @@ -112,7 +112,6 @@ static int serial8250_probe_acpi(struct platform_device *pdev) struct device *dev = &pdev->dev; struct uart_8250_port uart = { }; struct resource *regs; - unsigned char iotype; int ret, line; regs = platform_get_mem_or_io(pdev, 0); @@ -122,13 +121,11 @@ static int serial8250_probe_acpi(struct platform_device *pdev) switch (resource_type(regs)) { case IORESOURCE_IO: uart.port.iobase = regs->start; - iotype = UPIO_PORT; break; case IORESOURCE_MEM: uart.port.mapbase = regs->start; uart.port.mapsize = resource_size(regs); uart.port.flags = UPF_IOREMAP; - iotype = UPIO_MEM; break; default: return -EINVAL; @@ -147,12 +144,6 @@ static int serial8250_probe_acpi(struct platform_device *pdev) if (ret) return ret; - /* - * The previous call may not set iotype correctly when reg-io-width - * property is absent and it doesn't support IO port resource. - */ - uart.port.iotype = iotype; - line = serial8250_register_8250_port(&uart); if (line < 0) return line; From patchwork Fri Jan 24 16:10:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 859733 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) (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 EBF281A8F7D; Fri, 24 Jan 2025 16:15:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737735346; cv=none; b=X0wqcoWMBol6rTDowXb0n5MB1KuhXntenLjUfzB+txbvKsELCRlDl/2eE+n4YFUb5aHIpJxT6Ni+LzW7pzLzKkyEMmAtCu0vzpnO/lNIhGa2dyDSmCncUZLaN5/6kW0LcKYHfYERKOOOBktg/EaCl1TAbq1i51s6l+ICIxcI+yw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737735346; c=relaxed/simple; bh=A0FojVXkgR8AphBPnWDLaNoXKasJEidZcTtNFSFW/GY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ofKQ308EWdF4u9wIr7NNQWtb7YAyxSxV4zDdSIhiMQnpLpGhVHV1uMPwSNHI4r+Oi6W8FV+OsM3lrjNoOHj0YluyzlZ/+QUiuC52hbp9ave0OFaCsTLVYz8VYwZ6T1CSrMUYSMQ5gSnWuHt4WaW4HGWBvssCYF5fOIdxxI9XYLs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=WDRz8DYI; arc=none smtp.client-ip=198.175.65.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="WDRz8DYI" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1737735346; x=1769271346; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=A0FojVXkgR8AphBPnWDLaNoXKasJEidZcTtNFSFW/GY=; b=WDRz8DYI22cnNoxL+rJanynKD2SucAHtpubFhn+5SHouxYdDi287Dssh +5QHeUsxqe87SYGY/26LrHHOkbyNd0hoSvi0CIdpsFBZ5r7x7GEQecKli fvRVQ7/pqZmLU4MwE5cArwGWoyvDZKYOHJpqUe9KcTgtOkNoYM0StXmip F5UCJZW4E28TmrOvM3y6ZVwVzhBP/ziqP3dsT9VRhHAQwynfjFZq8xpkP MbrvS8WZn+NUD+gbmoraEL5vLAYxGVoq2ew6ImA+9yoLJixfHCDsvpfEr vJ4B3lP6ZrzhVdgru+ufDWFOtXHavQKtFTyOkdx7UQxqIeTe1DVnPv1Ns A==; X-CSE-ConnectionGUID: lN2vHLIuQUqXV1D4IBhFyQ== X-CSE-MsgGUID: 5ytmkB65QpGvEcjhq1tD9g== X-IronPort-AV: E=McAfee;i="6700,10204,11325"; a="38152901" X-IronPort-AV: E=Sophos;i="6.13,231,1732608000"; d="scan'208";a="38152901" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2025 08:15:44 -0800 X-CSE-ConnectionGUID: QX9lItmmQWSgoTpduHmCwg== X-CSE-MsgGUID: v9Sh7zx0Tf2W4HusQ5GyjQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.13,231,1732608000"; d="scan'208";a="107612372" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa006.fm.intel.com with ESMTP; 24 Jan 2025 08:15:41 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id DFD6F37E; Fri, 24 Jan 2025 18:15:37 +0200 (EET) From: Andy Shevchenko To: Greg Kroah-Hartman , Andy Shevchenko , Guanbing Huang , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Cc: Jiri Slaby Subject: [PATCH v1 6/6] serial: 8250_pnp: Remove unneeded ->iotype assignment Date: Fri, 24 Jan 2025 18:10:51 +0200 Message-ID: <20250124161530.398361-7-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20250124161530.398361-1-andriy.shevchenko@linux.intel.com> References: <20250124161530.398361-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-serial@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 If ->iobase is set the default will be UPIO_PORT for ->iotype after the uart_read_and_validate_port_properties() call. Hence no need to assign that explicitly. Otherwise it will be UPIO_MEM. Signed-off-by: Andy Shevchenko --- drivers/tty/serial/8250/8250_pnp.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/drivers/tty/serial/8250/8250_pnp.c b/drivers/tty/serial/8250/8250_pnp.c index 7c06ae79d8e2..7a837fdf9df1 100644 --- a/drivers/tty/serial/8250/8250_pnp.c +++ b/drivers/tty/serial/8250/8250_pnp.c @@ -436,7 +436,6 @@ serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id) { struct uart_8250_port uart, *port; int ret, flags = dev_id->driver_data; - unsigned char iotype; long line; if (flags & UNKNOWN_DEV) { @@ -448,14 +447,11 @@ serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id) memset(&uart, 0, sizeof(uart)); if ((flags & CIR_PORT) && pnp_port_valid(dev, 2)) { uart.port.iobase = pnp_port_start(dev, 2); - iotype = UPIO_PORT; } else if (pnp_port_valid(dev, 0)) { uart.port.iobase = pnp_port_start(dev, 0); - iotype = UPIO_PORT; } else if (pnp_mem_valid(dev, 0)) { uart.port.mapbase = pnp_mem_start(dev, 0); uart.port.mapsize = pnp_mem_len(dev, 0); - iotype = UPIO_MEM; uart.port.flags = UPF_IOREMAP; } else return -ENODEV; @@ -471,12 +467,6 @@ serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id) if (ret) return ret; - /* - * The previous call may not set iotype correctly when reg-io-width - * property is absent and it doesn't support IO port resource. - */ - uart.port.iotype = iotype; - if (flags & CIR_PORT) { uart.port.flags |= UPF_FIXED_PORT | UPF_FIXED_TYPE; uart.port.type = PORT_8250_CIR;