Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1406077imu; Sat, 26 Jan 2019 02:06:41 -0800 (PST) X-Google-Smtp-Source: ALg8bN4IUYFW+JwvM9eSUrgkmqE7uPzMNQ+NR2AF45sCPUZZ+jGffY0UecS98H3ztfAk3UbNtJ56 X-Received: by 2002:aa7:81d0:: with SMTP id c16mr14303828pfn.153.1548497201520; Sat, 26 Jan 2019 02:06:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548497201; cv=none; d=google.com; s=arc-20160816; b=EK5MMZGxpEEJImCdvqELnDQIDN9nD0lya9vjJn0wH0BBLi2Wlt5AGlfgpjRmhsuEXL L6+oDeCV4LSEKByQEjtzB4C5wjS54ihHN0m7bjLxF4SlgUu+Bs4At3rFWLEvxXhYfbIh NbkPbMUJO7YvMqYwu4IClKWPWhulkbA3DUfas2qC4O8hSq25WtP8x7S78aI7Ulzisyfg BVraO4ok3YuJT6XJfuwTRTfT9e8MRxIZg+ct8VlQcPRhymphNXr5zdxXvcJnigTouq4+ 9CCELEYd2NKKdTn8tbua46AFw+2YYUPrJQ3MS5O/yIcSwudD3emNkK1UYrMbTvvCzpbc UE0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=VemudvUZrcPVyEnzncZhnLffvlu7PDXof5bQlU6sb+4=; b=p+yZvS/j6WJ0k71nVc2TrWthoe8RLLYnByuRrD1IbVBA62Kpmv09PuQCtbyLtYvhN7 4qo0yQ4hQUm9XafKqXpXwFFyu5cbqAspGwT+tnecEFJMOti4cD52IUeO9+RwPPNByb3g CTz2Z/7PrY15rfX5SAG3qJIC1aFmJt9OGoU58WuLHKxWGAWWqR+fwlyT6R0gCXo4xRED TZjsnszoPPwP0sacroWyj7lzPQd6dXFjX+cdFfDYbXQKd1cy7B1UZaMlRK4d+GM/Zmi1 IEKk+Z0tTuVLLKr0KGy8nL3r1N6kIh1AeikBQHstRpRc24acu8nQHoeGTXDs3B+DS5ts RS9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="dAb/O/D0"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y188si7878720pfb.59.2019.01.26.02.06.26; Sat, 26 Jan 2019 02:06:41 -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; dkim=pass header.i=@kernel.org header.s=default header.b="dAb/O/D0"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729453AbfAZKGP (ORCPT + 99 others); Sat, 26 Jan 2019 05:06:15 -0500 Received: from mail.kernel.org ([198.145.29.99]:37404 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726143AbfAZKGO (ORCPT ); Sat, 26 Jan 2019 05:06:14 -0500 Received: from bbrezillon (91-160-177-164.subs.proxad.net [91.160.177.164]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9D9FF217D7; Sat, 26 Jan 2019 10:06:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548497173; bh=qOVJ0Jo+RKwjH9m0MuM310+kDMy2gAkYgzo5oU6geaw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=dAb/O/D0LaSEc3XW+1o/LrX4ko9RXL7vfBhfY/+tJcpDfTzBGPoBtTweyNhhaS+Hs iKmtrY8s0MBkKuwYabBMF5NRcVvXkpQVAqPiCx/E0B0OBgX/bUlBZ3pdrxKGoZflfr HpEzkzVXMNOT4Uzm1mm03YHeErWTRG6SkkiCNz0w= Date: Sat, 26 Jan 2019 11:06:05 +0100 From: Boris Brezillon To: Geert Uytterhoeven Cc: Arnd Bergmann , Greg Kroah-Hartman , linux-mtd@lists.infradead.org, Nguyen An Hoan , linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org Subject: Re: [PATCH v2 1/2] eeprom: at25: Merge "off" and "offset" in at25_ee_write() Message-ID: <20190126110546.360190cc@bbrezillon> In-Reply-To: <20190118140525.29189-2-geert+renesas@glider.be> References: <20190118140525.29189-1-geert+renesas@glider.be> <20190118140525.29189-2-geert+renesas@glider.be> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 18 Jan 2019 15:05:24 +0100 Geert Uytterhoeven wrote: > Since commit 01973a01f9ec34b7 ("eeprom: at25: remove nvmem regmap > dependency") changed the type of "off" from "loff_t" to "unsigned int", > "off" and "offset" are now the same type, and can be merged into a > single variable. > > Signed-off-by: Geert Uytterhoeven Reviewed-by: Boris Brezillon > --- > v2: > - Merge "off" and "offset" into a single variable instead of just > killing the cast, as suggested by Arnd. > --- > drivers/misc/eeprom/at25.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/misc/eeprom/at25.c b/drivers/misc/eeprom/at25.c > index 99de6939cd5ac2e3..2d8e5388e574710d 100644 > --- a/drivers/misc/eeprom/at25.c > +++ b/drivers/misc/eeprom/at25.c > @@ -130,7 +130,8 @@ static int at25_ee_read(void *priv, unsigned int offset, > return status; > } > > -static int at25_ee_write(void *priv, unsigned int off, void *val, size_t count) > +static int at25_ee_write(void *priv, unsigned int offset, void *val, > + size_t count) > { > struct at25_data *at25 = priv; > const char *buf = val; > @@ -138,10 +139,10 @@ static int at25_ee_write(void *priv, unsigned int off, void *val, size_t count) > unsigned buf_size; > u8 *bounce; > > - if (unlikely(off >= at25->chip.byte_len)) > + if (unlikely(offset >= at25->chip.byte_len)) > return -EFBIG; > - if ((off + count) > at25->chip.byte_len) > - count = at25->chip.byte_len - off; > + if ((offset + count) > at25->chip.byte_len) > + count = at25->chip.byte_len - offset; > if (unlikely(!count)) > return -EINVAL; > > @@ -160,7 +161,6 @@ static int at25_ee_write(void *priv, unsigned int off, void *val, size_t count) > do { > unsigned long timeout, retries; > unsigned segment; > - unsigned offset = (unsigned) off; > u8 *cp = bounce; > int sr; > u8 instr; > @@ -234,7 +234,7 @@ static int at25_ee_write(void *priv, unsigned int off, void *val, size_t count) > break; > } > > - off += segment; > + offset += segment; > buf += segment; > count -= segment; >