Received: by 10.223.185.116 with SMTP id b49csp4553765wrg; Mon, 26 Feb 2018 21:21:11 -0800 (PST) X-Google-Smtp-Source: AH8x227hlcVo45ObhyzbsWo/WJRib4dA8E918Mg3XvtWZjR+VBmurnHXbX++O8nuhtPlrM6hGe27 X-Received: by 10.99.117.89 with SMTP id f25mr10175964pgn.18.1519708870951; Mon, 26 Feb 2018 21:21:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519708870; cv=none; d=google.com; s=arc-20160816; b=Epl7PlkC62rkN8OwHWA9Cot3zpsm4LcRQ9fQ3vEnoDbXMd84Hi9A8JOFNX7UAZitYG O5b5KKLGGvtcJcs3baMP3bxNT8Q7//33SKKIJSTsudBarev9vEb0OjajIVnL69S1ZSvj YgyZkUKezFknMWR1z0XnK0Fa524GhaGlnwcdvwONXKU2BnaV7uo00D9f4AG8QMY2e+dZ CxJswtzx0SOtFIuV0hYz3gdwPSDzKlV8cpLZh1/+vnkdt6J0mBDhDNww8Z97CbeRecgV ssdhf+KULPQTaJsCnyupIZaZNxcrH+udZMPXNw0ryRshUIGHgE3ioajiuYBWh6N/s5wL i9ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=hJr0g/nyr/3Uh1oV63TcrC2hi2GJr7I1A1ClnCaQhjo=; b=C5QQ3NpnxWHt4gQ3DHx3WXnGHl0USnoX7DMMdgePnYYxSwh0eePGGvWdUWlQxLwDeA 0QI0FqKOmQfBe0/Crj5Wi0oBFVRqENR8vmzPdlO4yEt2hzmUar9p3qrKyv231pr8tbhw 0x3/WYhIh0/qVA7FzDkc3p4gQqh/DIxf0+VM4/YEUiG7lRYW3OeLBU2LY9QmWg7mIonB rPZ07EieTi/+THEZediKK9M4kNP+7tD5NTmeUhr75R1irxE2LaQ26UzxL1eGlKD2XZal 5wkYIZieL2zSu5VxuvU32RNajLrPxzH1/sdBVJTmPx3wWSuTF8L23J66ZSWAW25WFIEp kILw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n8-v6si6895076pll.695.2018.02.26.21.20.56; Mon, 26 Feb 2018 21:21:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751993AbeB0FUQ (ORCPT + 99 others); Tue, 27 Feb 2018 00:20:16 -0500 Received: from wtarreau.pck.nerim.net ([62.212.114.60]:40943 "EHLO 1wt.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751824AbeB0FUP (ORCPT ); Tue, 27 Feb 2018 00:20:15 -0500 Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id w1R5KBjj026817; Tue, 27 Feb 2018 06:20:11 +0100 Date: Tue, 27 Feb 2018 06:20:11 +0100 From: Willy Tarreau To: Robert Abel Cc: Miguel Ojeda , linux-kernel , Geert Uytterhoeven , Andy Shevchenko Subject: Re: [PATCH 3/4] auxdisplay: charlcd: fix x/y address commands Message-ID: <20180227052011.GB26781@1wt.eu> References: <9ec3c54c-f8fe-22d7-783e-8cf9862405bb@robertabel.eu> <20180225235432.31209-1-rabel@robertabel.eu> <20180225235432.31209-2-rabel@robertabel.eu> <20180225235432.31209-3-rabel@robertabel.eu> <20180225235432.31209-4-rabel@robertabel.eu> <1a02d35e-b87c-3751-eb1a-f3becee4aa6b@robertabel.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1a02d35e-b87c-3751-eb1a-f3becee4aa6b@robertabel.eu> User-Agent: Mutt/1.6.1 (2016-04-27) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 27, 2018 at 12:05:10AM +0100, Robert Abel wrote: > Hi Miguel, > > On 26 Feb 2018 17:49, Miguel Ojeda wrote: > > On Mon, Feb 26, 2018 at 12:54 AM, Robert Abel wrote: > >> + /* clamp new x/y coordinates */ > >> + if (tmp_addr.x >= lcd->width) > >> + tmp_addr.x = lcd->width - 1; > > > > tmp_addr.x = min(tmp_addr.x, lcd->width - 1); > > Had throught of that, too. However, it introduces a warning about type > mismatch, because lcd->width is int while tmp_addr.x is unsigned long > int. I didn't fell like saving a line warranted much bigger changes to > the lcd struct. The you can use min_t() : tmp_addr.x = min_t(unsigned, tmp_addr.x, lcd->width - 1); Willy