Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp967928lqm; Thu, 2 May 2024 00:48:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVLNe/gf7dBiS5CRi+vII33PTCtDK5tRzIkWSZ6gFXstkGYeb8QIAUVffgzglsUaXsztfn7mJFOsC3VHoCGO8m3XsiklQu11l4E9RlKgg== X-Google-Smtp-Source: AGHT+IG0hybSS3YMRHr5AsORw95xZWdr4uoMxgPK8HxRFgjAlGUS+bSTuNeAiLVRmRkonpdcilll X-Received: by 2002:aca:1a08:0:b0:3c8:61aa:838 with SMTP id a8-20020aca1a08000000b003c861aa0838mr5709274oia.40.1714636136603; Thu, 02 May 2024 00:48:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714636136; cv=pass; d=google.com; s=arc-20160816; b=Pmcol35fYrqe8NonK2TP1a1atW6IFNy1rzHvfX7MrFPG+Q4NrLWYUpBc/CwBw40Qd0 /OPbO1wme1wE+2ug2E02HvkloSQqOhCmu0riTEcjY8oAB8nf9cGpIanxJuQpwgwFno0q d1N3iqmKNKdzEulXGU5VB70SytUgYA6snyiPMXN9S+J7GCpp6kWvNuOSRGB6Igq67ER9 rVptpE7+ZtCDlosDIYABUTvWFucyYiPtF0+1MTvv0rUu7VadB028RLvKJQ+x372zwF8L o1QrEGqteGH1lwFtfV29842ZOkn1sZcRqnYp09kkzEtfxnMTMrjY3wieQVkT6CgLJASj s6Ww== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id; bh=J1VeJE3uwbizswlqzCeytkGg3Ha1OSAITb8Byl9VcCo=; fh=YeVjAc+S+Hk60ykU2ScYrrb9BJkDs9RaOLkzJ8EHF7Y=; b=m8xnlp3CSfGz1bq4X85XveM2jHr7UQ/3rv2/fqNy1raIlJFt1vCvA/D81iTbkZAKKI GG022XeMLdKw4mxSB/0OlvsLM9JGlxM6laTn6cNtnhgQiIljL/g7EDjn+59PvpbMw1Nx ZHUpVRnHdb7g1AMU7eNIa6XTD71nKo8u9w4Qxd6N6/yidfQcdpFfd2yr40XZmN20ptId jflWDfNzINEwurhqdT3KZ6O2mcUkY9YzLaiP1ddJkU7WptQjTuvNt48wE5WU2U27MZdh 51uVdaqKcF8MnGmhjQmi/Cz5x0WuXVcSdtlas14T6JtgVLwzHNmNkUrhDDFWjTqwGVgH ga8Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-166073-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166073-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id bb38-20020a05622a1b2600b0043ad4cfa02esi441316qtb.284.2024.05.02.00.48.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 00:48:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-166073-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-166073-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166073-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 46F691C20906 for ; Thu, 2 May 2024 07:48:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A7DA82557A; Thu, 2 May 2024 07:48:33 +0000 (UTC) Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8161922EF2; Thu, 2 May 2024 07:48:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714636113; cv=none; b=fkNAlhY86xit6soZ3cey19hK9mrwZwO5T7Ya79xmbrZMwXILuqrag0MYLt4wwTK5kJFbQh6Wzi/so9zHwQGVcePinGMlDdRy2u0TrydsyYc6/S6OihJwwGuBKIB9ggfGwByyCp79UZCBN6tBG4pnaeRDnz2PSv7/tuD6Oz7J3pg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714636113; c=relaxed/simple; bh=AyqpGCcx3pzUH4PEPahOYjVChU9L8yeZkhdfWdIn+kA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=nTgzv2J9qU2ElphHC69ESZ9Ry03sW8L+NSKWU3CW/EKytomTh0FkkRCdah+lN1PQLXaXuTJlhimUFYWaLXONDOnwlNfgaBeZZcAWtIRISPF9wzhxMLXtTpx7yicim4TV0dJi5y7zQDn04Wk9BIMI3rWBvpMS5vI3FrJw26lPGpA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.218.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-a58772187d8so889347666b.3; Thu, 02 May 2024 00:48:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714636110; x=1715240910; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=J1VeJE3uwbizswlqzCeytkGg3Ha1OSAITb8Byl9VcCo=; b=RD9a5srTsjk4kqoPSc7fesU1BlV6bJIYtHn5Q/EeK8kHz0CH6DGV3fi2pvH4KISb3x iKxVOlhfZ3s792azjQMTQHRWAVhBFRt+eBQFWSuZSJCFeyOH0R0CGRL88Q9u1dqxQDXK WWmBmNgvSz0u/dd9pLnljDrcMNzpfkAx72WjGhi1Wzq6X73nBMw/GitRrsOZ9XbWv9A9 xQbuIZ27uC6mJcOAv7ULA6gdJkst6CpDTKLd0Zr1VD7AhqVa79/C5aJJ0CfKs9B53392 yrM0WsawdyFHGQrwa/gngh8r6PSFm6r16lNhLPV0PjyzL1AyKU1bM7GN8a9cUMFlDXUv 39dg== X-Forwarded-Encrypted: i=1; AJvYcCUORSlUIpTuav0xgHboihtPh0b7TTU++mB0TxgxZ6bIM1DX0J3FNg/hBCwSiU0YNeAYPJvfYSi03HHtcDUdlHuoKhiH0OG6O9IkxtkmT0jBLmxcW6aMqbV12FlR3t74qG0L36wwRk+3+JkRNYvKbrAspebiOM0YdtMSuYBUpztzw12R X-Gm-Message-State: AOJu0Yw/33TpF/iBIRzBc/npXTREhuR9KBJQj+LWqt4tksl0FyGWtCNI qo6ukHGdkWxB7K6RTyPePBj/VLZVkLNpO/1SIhIeK2J6+cP0QBNTvuIsm6IA X-Received: by 2002:a17:906:c2ca:b0:a58:ab31:638e with SMTP id ch10-20020a170906c2ca00b00a58ab31638emr1002475ejb.44.1714636109493; Thu, 02 May 2024 00:48:29 -0700 (PDT) Received: from ?IPV6:2a0b:e7c0:0:107::aaaa:69? ([2a0b:e7c0:0:107::aaaa:69]) by smtp.gmail.com with ESMTPSA id a21-20020a170906369500b00a596ea236f4sm237646ejc.212.2024.05.02.00.48.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 02 May 2024 00:48:28 -0700 (PDT) Message-ID: <4f960a0b-85f3-403f-b75a-47fb1b4ea6aa@kernel.org> Date: Thu, 2 May 2024 09:48:27 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] serial: sc16is7xx: fix bug in sc16is7xx_set_baud() when using prescaler To: Hugo Villeneuve , Greg Kroah-Hartman , Jon Ringle Cc: Hugo Villeneuve , stable@vger.kernel.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org References: <20240430200431.4102923-1-hugo@hugovil.com> Content-Language: en-US From: Jiri Slaby Autocrypt: addr=jirislaby@kernel.org; keydata= xsFNBE6S54YBEACzzjLwDUbU5elY4GTg/NdotjA0jyyJtYI86wdKraekbNE0bC4zV+ryvH4j rrcDwGs6tFVrAHvdHeIdI07s1iIx5R/ndcHwt4fvI8CL5PzPmn5J+h0WERR5rFprRh6axhOk rSD5CwQl19fm4AJCS6A9GJtOoiLpWn2/IbogPc71jQVrupZYYx51rAaHZ0D2KYK/uhfc6neJ i0WqPlbtIlIrpvWxckucNu6ZwXjFY0f3qIRg3Vqh5QxPkojGsq9tXVFVLEkSVz6FoqCHrUTx wr+aw6qqQVgvT/McQtsI0S66uIkQjzPUrgAEtWUv76rM4ekqL9stHyvTGw0Fjsualwb0Gwdx ReTZzMgheAyoy/umIOKrSEpWouVoBt5FFSZUyjuDdlPPYyPav+hpI6ggmCT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5nVrrLDAJZ8Y5ioWcm99JtSIIxXxt9FJaGc1Bgsi5K/+dyTKL wLMJgiBzbVx8G+fCJJ9YtlNOPWhbKPlrQ8+AY52Aagi9WNhe6XfJdh5g6ptiOILm330mkR4g W6nEgZVyIyTq3ekOuruftWL99qpP5zi+eNrMmLRQx9iecDNgFr342R9bTDlb1TLuRb+/tJ98 f/bIWIr0cqQmqQ33FgRhrG1+Xml6UXyJ2jExmlO8JljuOGeXYh6ZkIEyzqzffzBLXZCujlYQ DFXpyMNVJ2ZwPmX2mWEoYuaBU0JN7wM+/zWgOf2zRwhEuD3A2cO2PxoiIfyUEfB9SSmffaK/ S4xXoB6wvGENZ85Hg37C7WDNdaAt6Xh2uQIly5grkgvWppkNy4ZHxE+jeNsU7tg= In-Reply-To: <20240430200431.4102923-1-hugo@hugovil.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 30. 04. 24, 22:04, Hugo Villeneuve wrote: > From: Hugo Villeneuve > > When using a high speed clock with a low baud rate, the 4x prescaler is > automatically selected if required. In that case, sc16is7xx_set_baud() > properly configures the chip registers, but returns an incorrect baud > rate by not taking into account the prescaler value. This incorrect baud > rate is then fed to uart_update_timeout(). > > For example, with an input clock of 80MHz, and a selected baud rate of 50, > sc16is7xx_set_baud() will return 200 instead of 50. > > Fix this by first changing the prescaler variable to hold the selected > prescaler value instead of the MCR bitfield. Then properly take into > account the selected prescaler value in the return value computation. > > Also add better documentation about the divisor value computation. > > Fixes: dfeae619d781 ("serial: sc16is7xx") > Cc: stable@vger.kernel.org > Signed-off-by: Hugo Villeneuve > > --- > > Changes for V2: > - Change prescaler type to "unsigned int" (Jiri S.) Thanks. Reviewed-by: Jiri Slaby -- js suse labs