From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751208AbeAVRGW (ORCPT ); Mon, 22 Jan 2018 12:06:22 -0500 Received: from vern.gendns.com ([206.190.152.46]:51802 "EHLO vern.gendns.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751087AbeAVRGU (ORCPT ); Mon, 22 Jan 2018 12:06:20 -0500 Subject: Re: [PATCH] pinctrl: pinctrl-single: Fix pcs_request_gpio() when bits_per_mux != 0 To: Andy Shevchenko Cc: linux-arm Mailing List , Linux OMAP Mailing List , "open list:GPIO SUBSYSTEM" , Linux Kernel Mailing List , Tony Lindgren , Haojian Zhuang , Linus Walleij References: <1516575793-30526-1-git-send-email-david@lechnology.com> From: David Lechner Message-ID: Date: Mon, 22 Jan 2018 11:06:18 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vern.gendns.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lechnology.com X-Get-Message-Sender-Via: vern.gendns.com: authenticated_id: davidmain+lechnology.com/only user confirmed/virtual account not confirmed X-Authenticated-Sender: vern.gendns.com: davidmain@lechnology.com X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/22/2018 08:49 AM, Andy Shevchenko wrote: > On Mon, Jan 22, 2018 at 1:03 AM, David Lechner wrote: >> This fixes pcs_request_gpio() in the pinctrl-single driver when >> bits_per_mux != 0. It appears this was overlooked when the multiple >> pins per register feature was added. >> >> Fixes: 4e7e8017a80e ("pinctrl: pinctrl-single: enhance to configure >> multiple pins of different modules") > > One line? One line is more important that wrapping to 75 chars? > >> + byte_num = (pcs->bits_per_pin * pin) / BITS_PER_BYTE; >> + offset = (byte_num / mux_bytes) * mux_bytes; >> + pin_shift = pin % (pcs->width / pcs->bits_per_pin) * >> + pcs->bits_per_pin; > > Sounds like playing around pretty well defined macro and functions, > e.g. DIV_ROUND_UP(), round_up(). > I admit, I just copied existing code (which may be a reason to leave this the way it is). But, I only see once place to do this: offset = round_down(byte_num, mux_bytes); Did I miss another?