From patchwork Mon Apr 8 03:36:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guanbing Huang X-Patchwork-Id: 787006 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01olkn2028.outbound.protection.outlook.com [40.92.53.28]) (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 B959D187F; Mon, 8 Apr 2024 03:36:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.92.53.28 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712547406; cv=fail; b=BH9zzTpV3NkNv5Q1jg7XBVzAIZzTg/6/EcPh1XxEuKhQLN1bzC0JGxor/3SgoId8fdzRT30/nGVgo+eN9R7KBt+mRr+E8/wlhtqjcRiuCA0r+rbsDkpE6narnnAg4AnMsR60vqQuy+eIN/b3HvAyUko1LzVEGV0MpKhOuOEvwlM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712547406; c=relaxed/simple; bh=+pzfuCzPRwb6PxOClH/EItwayzRJ06WjayFWikVZrbg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=TDDrWP3JErMe4gkIZ5JHy1V10oWKWYsZps0957YkVQxzpOuSu2uOB2mNmRDci5ugIXhuo0iP7wm0duxpzaObgIfITAKBUWeEh+c8zU0lLu+9cnyJ2/oAvYHfvABRFwp/y1giv7YhHiBPrA4wOMfvLNhotHohtwVAHQSOhchZVVs= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=outlook.com; spf=pass smtp.mailfrom=outlook.com; dkim=pass (2048-bit key) header.d=outlook.com header.i=@outlook.com header.b=i92VHKfz; arc=fail smtp.client-ip=40.92.53.28 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=outlook.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=outlook.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=outlook.com header.i=@outlook.com header.b="i92VHKfz" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aqsZ3faBwYRzg3UIhyKSC70k2NNM2Wp73QQmC+cIwuYvjgBxYFzRe8UvgC+D9Bdx2FArHcdFHDGZqn5eVtar9xAIW2Uh6Jxk/ODXarsnpeeNffHhY5n1HGISLcV/CzIXaDsVWp43a8cqmzNlqbYYnb2f/RrNOBNv7qBa/fVuHfiNqNMJOp2QmpdZbAqvvxLilYeirofNlsATryavb5vqco4MUBXzklGRsClwp+LpEEBg6jtEnZok9ktwdBt4+HVZuhhnKF3j/NM6mMidqNBlaOyhOGe62qlV8JCHsHir+taa+7wmpNNfqXIzipdHXHm3vuYRD93h4BzJTgUVtDvGNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=csW8Ke7ZaM6IlQ3PEizPMkg1sdPp4F6OXfq38SG0QDo=; b=ETMR2Uqo9XVTj8SEYdUUt2AlrxjUkP997kffprBw5cs0R8MXTzRBApcSFw2O/rIzz4oURB/sKAA7dXzisK54mL6yFq5abrrxYwHShHdAQ4IwD8Fwkrcw+jN+jfIsD/SemG/nIdAi0yt8EgCRKioL2R36wIxOpRyh8z1zlR/u/+cwkRYUIrjonlWOAGlMRjkUzZ4e1XDadKjIWKX72gUbUNxpN4mz2dIL/rThOELTPIR3ud5ta5XzSG37/qjyTK48JNaQNWSOC0v7gNHkBZVmGnHItrN9zn4xIE0aHMX+KVP0+fUxjpBD6aIoBbSupjrftWKfM9XNo+Hoa6qlh0gT1w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=csW8Ke7ZaM6IlQ3PEizPMkg1sdPp4F6OXfq38SG0QDo=; b=i92VHKfzlh7jqpKRfeh5Y6nDIpCcOhTMhMDJjqAPXTHV/RIlWhIqYTMarzXesS7sADUfMupF94f7ZU/xcCW9tuoiOVkquk1jPk8Q8UD3ovvNuYgiRqXxso5Y2wFE5uChuiFu8mzBOGUqPDwuVbVDzP2vgJL0QiCbGbAJtchBi+sxPCFcGsIrPMh9VYxo20alJ6zsC+5ldxwsJUWAOIg04i1kFkUr3HOB1RkpuYjRZb3aWdbq4yUnkbFzVKCvtQDica+W9z4WV2PGarzAKsNQWiI0AWtSVEayLyjCILsqVbY5ygMK9uPPqJejvXrW9M/C4B3T3eX0SqgE3N5aHhwXcw== Received: from PSAPR06MB4952.apcprd06.prod.outlook.com (2603:1096:301:a3::11) by KL1PR06MB6041.apcprd06.prod.outlook.com (2603:1096:820:cb::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Mon, 8 Apr 2024 03:36:38 +0000 Received: from PSAPR06MB4952.apcprd06.prod.outlook.com ([fe80::45cb:f62c:d9bc:b12b]) by PSAPR06MB4952.apcprd06.prod.outlook.com ([fe80::45cb:f62c:d9bc:b12b%7]) with mapi id 15.20.7409.053; Mon, 8 Apr 2024 03:36:38 +0000 From: Guanbing Huang To: gregkh@linuxfoundation.org, andriy.shevchenko@intel.com, rafael.j.wysocki@intel.com Cc: linux-acpi@vger.kernel.org, tony@atomide.com, john.ogness@linutronix.de, yangyicong@hisilicon.com, jirislaby@kernel.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, lvjianmin@loongson.cn, albanhuang@tencent.com, tombinfan@tencent.com Subject: [PATCH v5 1/3] PNP: Add dev_is_pnp() macro Date: Mon, 8 Apr 2024 11:36:22 +0800 Message-ID: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-TMN: [wp7oDCUwKJ7ulSI08kmeuxpQuKYWzBwa] X-ClientProxiedBy: SGXP274CA0001.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b8::13) To PSAPR06MB4952.apcprd06.prod.outlook.com (2603:1096:301:a3::11) X-Microsoft-Original-Message-ID: Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PSAPR06MB4952:EE_|KL1PR06MB6041:EE_ X-MS-Office365-Filtering-Correlation-Id: bb864f30-2d85-475f-698b-08dc577d191c X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sw2+EHLOMINebkXpPd1YzB2OE2G8WmyEBjWnw2F3xx6GppQFXS4ZL0JM8/Xbc/Ovoye0/U2TrvDY+RkkRPgOYyc10F/Prx4SLW2ZSR0DCuWtuaIGjBmma5G/hM/aIjKNUGULNS4T70rRAPqB4Eie2aECciMIhx6vwrAHYT6nGOHJIGRZiWP0B/Gb5dkCDKHQOuKqrWx8qwjdYeWs1qyNKLSKpFHUBKX6HXuVO2EKyTOEulKat6JUIvpvUSYTx8/XmGvA6rY0QhwzEohQ2TIoLTxGtXnEha2vj1+7g7LJ5yGc2YFAzEG+dVMFIjCzD7/ij8daOh8LAUoJpqh6IZStfwiaB5FLvwIuNpqkf6p8V66fp3KnRA6pLnC7JC1H1vkXrM4CwuWKEH4wbT9Vrd6KLREKmW1Icb3FcbDGdLN/2mDd5pPUvY1nyArxlcWL4QH1TxE/HTstcYKykUpE6f5GyH7YimdsQUAWEAD+P900EW8Uh/e8TSN6a/WhH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tSTuq1yIkpwIe+VFsxlV+1/YQ+oTLXeejVHHjonGqPjbCPYjLXFbvoVEqqZ1iUIbCnZLSZl70YAPWxIEPoM2wcZjyPEiulrt8dn/q13tI+Gtk0L1iKGo/GbpSr2vRxMw0f32EPa8z7ffnSvVBo7rB7VvLEkSjTi0vW2TTYMYOdcVSkFCpJvid17lT4ri4dpjcA+BZo7w5a7u/LUHSdUW44bjyhhjLAsPrWCKQXknczDLoFvcOxL9vbOehGw9EwAZM/0GlOV3tbqpmxKPmnuVFOxRvU5EJut+jSysQW4oj+dz338keqLBqd8iF/E9q2o= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: bb864f30-2d85-475f-698b-08dc577d191c X-MS-Exchange-CrossTenant-AuthSource: PSAPR06MB4952.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Apr 2024 03:36:38.5633 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB6041 From: Guanbing Huang Add dev_is_pnp() macro to determine whether the device is a PNP device. Signed-off-by: Guanbing Huang Suggested-by: Andy Shevchenko Reviewed-by: Bing Fan Tested-by: Linheng Du --- v4 -> v5: change "pnp" in the commit message to uppercase include/linux/pnp.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/pnp.h b/include/linux/pnp.h index ddbe7c3ca4ce..792921c06594 100644 --- a/include/linux/pnp.h +++ b/include/linux/pnp.h @@ -502,6 +502,8 @@ static inline void pnp_unregister_driver(struct pnp_driver *drv) { } #endif /* CONFIG_PNP */ +#define dev_is_pnp(d) ((d)->bus == &pnp_bus_type) + /** * module_pnp_driver() - Helper macro for registering a PnP driver * @__pnp_driver: pnp_driver struct From patchwork Mon Apr 8 03:36:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guanbing Huang X-Patchwork-Id: 787572 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01olkn2028.outbound.protection.outlook.com [40.92.53.28]) (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 B45B05244; Mon, 8 Apr 2024 03:36:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.92.53.28 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712547408; cv=fail; b=FJNv9fBAQr1Xca0Q1kOyfKX4v0+EZSfQQkxKm/+E8lj/7iftZELgfF3ajpdfjtLP4vI3oXWewUnAq2PbaXOhcamTmOqjXGamJJGJ93OPZ9HMlVfQ6IWAFxeVT5E6FNKX1XMQk0IjJdUdbdpPGa9AjkYTu1PcsBKnNfjtoGXcero= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712547408; c=relaxed/simple; bh=cMyIdOCMZt6YWmxQJIAjmCaHnJL37Mgtp+88RpCyhPg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=JcYBrVli8Ad1oCawbWOz/nUF5yHmbXUIEriyFunV/BDMu05UgS54dVXy6j/YTjh56GSXw0fcz9aW46hOHRt4tRZ62L+wTnhN7XvcH9ZYSB4mG7d1oBiAwjkMUg5kX7aRY6A5TlacQoJEfMQdpqfdshsK4iQrMtscu64ZOn02TaA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=outlook.com; spf=pass smtp.mailfrom=outlook.com; dkim=pass (2048-bit key) header.d=outlook.com header.i=@outlook.com header.b=WzmjLvDs; arc=fail smtp.client-ip=40.92.53.28 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=outlook.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=outlook.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=outlook.com header.i=@outlook.com header.b="WzmjLvDs" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P0Zf0OVOEasabu4BZHk1ujSzsj0REVQcB2VV2ahoIX4ZNXU2eu/Y7dTGOSsICOa0LrXvbnUSuGspBrrSdXNE712swfq3oBvCxp5VJg0+4uhY2jjTV/GNPb28/DRKaZHu6wSvDcxEL+xvQbooM5efcn7+Aih3nHqiyDW4AMqhm3xR9gTvPQLQfSKk5ZBgF51hrF9xJLHtshhnezszQfubLb4FuXUhA9WvHR287aB2QPTTzu6EhmYC72xpGCR2GQn4gAPKuj9pDOruKo8Zww9Bdf70xqb6EDF3WjXLtqpy81WShuhowTO7IGVYpBgqO1cMEpjaACqQ8ltVY5iftGIrzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=iQAkg9s38iV7LKj7Kma2OA4gmVrARWTRgWFnKRlnZQk=; b=ViozGUK6scX17uujFEGfK56JG8HXwQG4mzJoBX5XsZDmcZKT9rPRqOTKrHF8axy1qP4Oa06nX3VBtIlSL4ao/7BHSbn+q/N0E9reyAL3nUkBpgFaw5YsR7oGDZ8alia0wMUJLkT+Q13O/0Pk4QB/ARN2xF8G1PC4zIYiYJIv4tcDCtitj+PcRSo1yBw1m8MVnBWYCQAUG9hpb4cOaAkF2C5BFAlhb1xp5cydwVoJ6SBSL7pRHJwAPSIK/wBproHwwpqkV8KdLD5OCy/xG+nfF40gbP26C56wNffL9FnIU6KpnQuImItxhpBXHayC3j+MYQmm3UlNcBdufv3iBVXsng== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iQAkg9s38iV7LKj7Kma2OA4gmVrARWTRgWFnKRlnZQk=; b=WzmjLvDsXV+Q00FSC2lkVRsnxZxU7SVGouezJD1xz/0TGl31iu6YlW0AXEsf+KcqTl2+jXlsLEtQCaSxetQ4GcebsFUTsci18cfZH4PMeI0toQ1EDZWw2uNL4tLJhzb7+NAxMqWX9uonJ4geGhMKpfwS0WgXT3pVQgVs1wJkIGXV34HghIp26hHJYU6hCm/OULoxsPF61ycVJn9u/pbrgCaaueLsiEGnjXvAGU/BHzzyBlTGHCyBtrbWfqIgthmbkeiW+njl14RI87+zWItipZ/ZsYuijPRuGicl62pDPimvw+LOogoP3N/9bPztn45k9XFz5lqPxCGll1RJ+z50sQ== Received: from PSAPR06MB4952.apcprd06.prod.outlook.com (2603:1096:301:a3::11) by KL1PR06MB6041.apcprd06.prod.outlook.com (2603:1096:820:cb::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Mon, 8 Apr 2024 03:36:40 +0000 Received: from PSAPR06MB4952.apcprd06.prod.outlook.com ([fe80::45cb:f62c:d9bc:b12b]) by PSAPR06MB4952.apcprd06.prod.outlook.com ([fe80::45cb:f62c:d9bc:b12b%7]) with mapi id 15.20.7409.053; Mon, 8 Apr 2024 03:36:40 +0000 From: Guanbing Huang To: gregkh@linuxfoundation.org, andriy.shevchenko@intel.com, rafael.j.wysocki@intel.com Cc: linux-acpi@vger.kernel.org, tony@atomide.com, john.ogness@linutronix.de, yangyicong@hisilicon.com, jirislaby@kernel.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, lvjianmin@loongson.cn, albanhuang@tencent.com, tombinfan@tencent.com Subject: [PATCH v5 2/3] serial: port: Add support of PNP IRQ to __uart_read_properties() Date: Mon, 8 Apr 2024 11:36:23 +0800 Message-ID: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-TMN: [rzNVr0/+DzC9PN+ledG6BYbI7AXuQytv] X-ClientProxiedBy: SGXP274CA0001.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b8::13) To PSAPR06MB4952.apcprd06.prod.outlook.com (2603:1096:301:a3::11) X-Microsoft-Original-Message-ID: Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PSAPR06MB4952:EE_|KL1PR06MB6041:EE_ X-MS-Office365-Filtering-Correlation-Id: c692a7ec-a4be-4499-84ed-08dc577d1a2a X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BYgK1D7upVtqU001q/Y46cCXxCAvL+uOBMpbbQD42VU9XktnBacxuwxWk0OH1RIjRZ7Goa1jl+CTHF0dU4dVZOdyk3QyWXee1nT36nNJmITwp7DfJQuHHLpQwMWC7Z1qOH0ztWxq/ApSzbREEIBJqqNNnsndqpXAwdT2839zNXqm5DhSFi6AKBukE0AtIgaZPRwNLQ0VnxS+vBnsL98+UJT+KcNfyr//SMdrW42e8a3EU2EWJ8k/4Sj6vaulJXDDKHvaP5kUBhArhLn2jDtsEXHCOIvYGARQEikr0NdeYNJ4P1z7a/C68POyd1KwaNcjIYu2//WvA1iPA449t1UopVihg1hGVQshy9s7bxAgAfI44+zGY+dy9Oqg2oO0Hwl0RDrQMAUhPZc/cNdU8KnZjM1/FYvZz4G3/UDwdhFr/lY+FiCxaEo00SIRiSG27MGfRzNdDnnm0o0J/Bi0oDhvXjPXOskT8iAsrwQAI79vMW7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3vOOKUziOaSF3cn+azxHH76aWhaTUMJsnOa8UPyMXIJG/lrRTSGPfvJCBuDeYcFUL2NjhsAqoYeMRh+rxMRchOzRD0z1EjJ4yMn3SHL67b2JqKSGHIa6mSxPG/nmhIHTXF2brxmantMGJrBj92384HYUnE2wCRpyJPHzfzWX2pAKz+6PWjYsQfDAxy99QTZREnzbj6C1yQ3RX3887Ze0XgAKD2MCDIHq1v0OQMo/hfOpih6TLj+KYCaL3ip1pTwX/Suob4bUcUOO80VKaXROZcdH9JGJfVqjUQqH61ZDBv3tqY6Q5Yxn5xC4= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c692a7ec-a4be-4499-84ed-08dc577d1a2a X-MS-Exchange-CrossTenant-AuthSource: PSAPR06MB4952.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Apr 2024 03:36:40.2727 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB6041 From: Guanbing Huang The function __uart_read_properties doesn't cover PNP devices, so add IRQ processing for PNP devices in the branch. Signed-off-by: Guanbing Huang Suggested-by: Andy Shevchenko Reviewed-by: Bing Fan Tested-by: Linheng Du --- v4 -> v5: change "pnp" and "irq" in the commit message to uppercase, modify the subject to start with "serial: port:", modify the location of the header file pnp.h drivers/tty/serial/serial_port.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/serial_port.c b/drivers/tty/serial/serial_port.c index 22b9eeb23e68..8504bae1d2c9 100644 --- a/drivers/tty/serial/serial_port.c +++ b/drivers/tty/serial/serial_port.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -221,7 +222,11 @@ static int __uart_read_properties(struct uart_port *port, bool use_defaults) if (dev_is_platform(dev)) ret = platform_get_irq(to_platform_device(dev), 0); - else + else if (dev_is_pnp(dev)) { + ret = pnp_irq(to_pnp_dev(dev), 0); + if (ret < 0) + ret = -ENXIO; + } else ret = fwnode_irq_get(dev_fwnode(dev), 0); if (ret == -EPROBE_DEFER) return ret; From patchwork Mon Apr 8 03:36:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guanbing Huang X-Patchwork-Id: 787005 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01olkn2028.outbound.protection.outlook.com [40.92.53.28]) (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 C268E79EA; Mon, 8 Apr 2024 03:36:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.92.53.28 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712547410; cv=fail; b=bRb6hIdjZcbBNB31EDLt0IE60ps23+iL4Jo8zk3oJoX6Ywx7wHmFI7XNc6dyz5FVLrwS9K4yXfGc0qXKX9ky6stxhDVX2FC9X8/W6e7jWfbDTctgKFhlYAiQ6N7NxxyXOAFydgF7coKKY6qxNpO7RTRoAYFIfKFkmPgzY6cxQL8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712547410; c=relaxed/simple; bh=WhbR4GTxOSKcl1KYo4+lWZjSx6OC3WMaT/3ec8NLZUk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=pmvImImAE3AaC1n+s+qXDJ6d0P19mt4OQmbV7lYzUYFM2RL1k3bZDtR0wn4F8Ml0ZSpXIcF73uZSz5CoPNh3PagSosgGM3UFYS4+Bv1WxHgstktecrf7/8v2f+uqyCwbx5BbO1fOAcLhvsZo+sXh/igN/d9f4t2Z8pjxh/NcxPM= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=outlook.com; spf=pass smtp.mailfrom=outlook.com; dkim=pass (2048-bit key) header.d=outlook.com header.i=@outlook.com header.b=MwwzkUxy; arc=fail smtp.client-ip=40.92.53.28 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=outlook.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=outlook.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=outlook.com header.i=@outlook.com header.b="MwwzkUxy" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JE9U1XgvbcbjQGSOW08hOKIBu/BCO8RNUK+e1f41PSrK+DsbqRvoVrpP4eMI2dfV/Bnvem6hO7svf0ciK+gfw9A+r2z6uBSzFDF3ZwvnZPk6ggClSuwkU/De2Hjinsnur3QsULn9XNvakjNL7q0HPjx/yh9uL+H/cHhW7bMXS8skEJQXjhxnf6YTNuCkVIXz2kTNS9DcvShwjEY4XWOeBs8YguWpM6ljk+wdd594UnxDo2O1hxMZivh6+2fuX3pu0SesYHOt9s974t+VBo2/PGvpV0laH1Kzj8O7FXTf9Cjx82ZM+Matg/s/adXTZyVpsO0IIh6y2TxLZLbi+/51hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=sdW0SNkOjR1tcmS6Pv0SI6X7idRxLDKR79Uz6pF5wxA=; b=cnrWqnxBJZ/bp0dyCRqdaxdYvqnSkT1WwKnzH0QinF4U0wKZd4tos/T6lhQ6RElM7Pi1LsNT5jCDhIzsLwE6r1+Qy0p1LqPxHDfmX+2HJUGq+IH05AkDOkjLE5ghpbBWHrac+r7BK+peB6cIe3uxfZs7ffk3F0W9ob+5Y75pDf46fc5ZA59NPbXCdmEEBPab/yu9f3FadPOm9b06mi8ZunxhfpgBqNDNXfqO3Im30WEseMKJXVZY9kxCrqhRUuR4e1ulW+ahw5LdRSb7vldYJRHZetWZ4wJoKr3zExSACirnen+ZOnpXisYC5SjqGgBrEg9gYvxKoM5zWLEAY5knLA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sdW0SNkOjR1tcmS6Pv0SI6X7idRxLDKR79Uz6pF5wxA=; b=MwwzkUxy37s0gDaZ8cg9af9LhUyamhT7QwnWjVbbjJXAUNGzUXbMxr2vnX9Iku5/0gL+PPd1tTw3ou6Ur9xsOT3qtKCYQC92OXECUxTzBDJGljgGqQ5Bx+IKAs9Ot9CapUtGeyFd5EllYHlnJPXEICyYqjHxsHNQGMLRIIuQsdRlbUkJZwNhas1WoGquMsTShFoj4pxcUz+i3PmNF1S5HbIfb3VrN0Yf07oDcBpc8TuH0psefqxohqI8RA0k50v2XJbwhKDDI63Nx1ZpqPhrf1h7cF59mE50gR59WsTPLfA7hPanlPe26xXjqCKBz/S4EvxHyqD65o7zyfXhsj1c3Q== Received: from PSAPR06MB4952.apcprd06.prod.outlook.com (2603:1096:301:a3::11) by KL1PR06MB6041.apcprd06.prod.outlook.com (2603:1096:820:cb::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Mon, 8 Apr 2024 03:36:42 +0000 Received: from PSAPR06MB4952.apcprd06.prod.outlook.com ([fe80::45cb:f62c:d9bc:b12b]) by PSAPR06MB4952.apcprd06.prod.outlook.com ([fe80::45cb:f62c:d9bc:b12b%7]) with mapi id 15.20.7409.053; Mon, 8 Apr 2024 03:36:42 +0000 From: Guanbing Huang To: gregkh@linuxfoundation.org, andriy.shevchenko@intel.com, rafael.j.wysocki@intel.com Cc: linux-acpi@vger.kernel.org, tony@atomide.com, john.ogness@linutronix.de, yangyicong@hisilicon.com, jirislaby@kernel.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, lvjianmin@loongson.cn, albanhuang@tencent.com, tombinfan@tencent.com Subject: [PATCH v5 3/3] serial: 8250_pnp: Support configurable reg shift property Date: Mon, 8 Apr 2024 11:36:24 +0800 Message-ID: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-TMN: [VZJPVSEk6YzzcUEqQvyxglAmKWwm8DNf] X-ClientProxiedBy: SGXP274CA0001.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b8::13) To PSAPR06MB4952.apcprd06.prod.outlook.com (2603:1096:301:a3::11) X-Microsoft-Original-Message-ID: <3049b47a51fb403d6b1e97e63fcae70e1a810963.1712472167.git.albanhuang@tencent.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PSAPR06MB4952:EE_|KL1PR06MB6041:EE_ X-MS-Office365-Filtering-Correlation-Id: ce0da03a-2628-418b-d662-08dc577d1b2f X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BwoO+chS6dOQ9T/J09lzEj+AhTOrOpJ7lx0C8CjVvoCOhIRq+7unyXoipgBdVDEfxSfBN+S/GloKBArGSKrwvhM4JPiNPfMxPX9IZMd2Aft9fwuw31IRo6qPNQE5VlJEGsb8svKp2IVhf0rIcct8rQgGQhScfzzlNgMuCC2QUSQCdvvGWM10YvOR5YLl3O/hIuUjyKCABZk62tWTTfv7DIn8JUJE8gFjy9gz1X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WmtVylYNDNkFxGECNKbhZm+uXNMOK0wFDeIdTcMVkRkVnNvJutC/d+MfmqRCPGy+zxmg0DSJKW8/UqZnw5LIAzFpCZIk0S9Zc9TsLFGWazqRAOslt29bhO+oDcfaOZjYnpC7XL4IYROK4ZKh9pwY/PSPkH4+kMC/jlAv7pTMjBKwSA7vXt00TOabbooSK/5NWyJA8xyrMTEp6X16I29lncqsiR5qdlIWrB3/4P1HN8OieoqMnBLrvECBFqNfpT9A4dcnHJs6ScnQwhMJZMogqxj1QEP+GM1WSqXdUQWt84gtrSYyz2vY4uRbYuZ+r7nzvQTafjaLepMCg3HLd5TreCpcNDx4RPTnZJjXTdHWXiFUVQxavvTbPKGlOirKmxKyWUVZRFYZ1uz90APJB73r/XILWDUizDVzU70wmo/INqU3OBI3n8BVIxeMmtygPQ6qJJTbru+JdvXjB/LWcWPhkDZQoLlQ4x7WYJaLIvIOSJV8NVNbImCkYuGJCm+hiLJGZEaw3M8427Osj+SE4YBtBDcPTj/IlzX0mj8tI7+oeeVxcw2mEuWDknN9BGi5M02TvA= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ce0da03a-2628-418b-d662-08dc577d1b2f X-MS-Exchange-CrossTenant-AuthSource: PSAPR06MB4952.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Apr 2024 03:36:42.0947 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB6041 From: Guanbing Huang The 16550a serial port based on the ACPI table requires obtaining the reg-shift attribute. In the ACPI scenario, If the reg-shift property is not configured like in DTS, the 16550a serial driver cannot read or write controller registers properly during initialization. Signed-off-by: Guanbing Huang Suggested-by: Andy Shevchenko Reviewed-by: Bing Fan Tested-by: Linheng Du --- v4 -> v5: modify to obtain the value of mapsize through the pnp_mem_len function, add annotations for the iotype variable, delete excess uart.port.flags operation v3 -> v4: dependent on two pre patches: "pnp: Add dev_is_pnp() macro" and "serial: 8250_port: Add support of pnp irq to __uart_read_properties()", the iotype is reserved, the mapsize is initialized, fix the UPF_SHARE_IRQ flag, check for IRQ being absent v2 -> v3: switch to use uart_read_port_properties(), change "Signed-off-by" to "Reviewed-by" and "Tested-by" v1 -> v2: change the names after "Signed off by" to the real names drivers/tty/serial/8250/8250_pnp.c | 40 +++++++++++++++++++----------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/drivers/tty/serial/8250/8250_pnp.c b/drivers/tty/serial/8250/8250_pnp.c index 1974bbadc975..8f72a7de1d1d 100644 --- a/drivers/tty/serial/8250/8250_pnp.c +++ b/drivers/tty/serial/8250/8250_pnp.c @@ -435,6 +435,7 @@ serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id) { struct uart_8250_port uart, *port; int ret, line, flags = dev_id->driver_data; + unsigned char iotype; if (flags & UNKNOWN_DEV) { ret = serial_pnp_guess_board(dev); @@ -443,37 +444,46 @@ serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id) } memset(&uart, 0, sizeof(uart)); - if (pnp_irq_valid(dev, 0)) - uart.port.irq = pnp_irq(dev, 0); if ((flags & CIR_PORT) && pnp_port_valid(dev, 2)) { uart.port.iobase = pnp_port_start(dev, 2); - uart.port.iotype = UPIO_PORT; + iotype = UPIO_PORT; } else if (pnp_port_valid(dev, 0)) { uart.port.iobase = pnp_port_start(dev, 0); - uart.port.iotype = UPIO_PORT; + iotype = UPIO_PORT; } else if (pnp_mem_valid(dev, 0)) { uart.port.mapbase = pnp_mem_start(dev, 0); - uart.port.iotype = UPIO_MEM; + uart.port.mapsize = pnp_mem_len(dev, 0); + iotype = UPIO_MEM; uart.port.flags = UPF_IOREMAP; } else return -ENODEV; - dev_dbg(&dev->dev, - "Setup PNP port: port %#lx, mem %#llx, irq %u, type %u\n", - uart.port.iobase, (unsigned long long)uart.port.mapbase, - uart.port.irq, uart.port.iotype); + uart.port.uartclk = 1843200; + uart.port.dev = &dev->dev; + uart.port.flags |= UPF_SKIP_TEST | UPF_BOOT_AUTOCONF; + + ret = uart_read_port_properties(&uart.port); + /* no interrupt -> fall back to polling */ + if (ret == -ENXIO) + ret = 0; + 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; } - uart.port.flags |= UPF_SKIP_TEST | UPF_BOOT_AUTOCONF; - if (pnp_irq_flags(dev, 0) & IORESOURCE_IRQ_SHAREABLE) - uart.port.flags |= UPF_SHARE_IRQ; - uart.port.uartclk = 1843200; - device_property_read_u32(&dev->dev, "clock-frequency", &uart.port.uartclk); - uart.port.dev = &dev->dev; + dev_dbg(&dev->dev, + "Setup PNP port: port %#lx, mem %#llx, size %#llx, irq %u, type %u\n", + uart.port.iobase, (unsigned long long)uart.port.mapbase, + (unsigned long long)uart.port.mapsize, uart.port.irq, uart.port.iotype); line = serial8250_register_8250_port(&uart); if (line < 0 || (flags & CIR_PORT))