Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1298054lqm; Thu, 2 May 2024 10:20:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW+fqJ7ypwHlTcZoNfxupjV8zsZ4JZWo1cvl38PAUYSIvOkTDiXFTzOu9617tjRDrdkVGCQtC63LiHSvm8K/VTbHPawkalGGPNMXMpbnA== X-Google-Smtp-Source: AGHT+IGgU67LPOsnJht7baHtILk+rxNDvdTkuLpOyKROt+aZSVZddPhw/HtHjPlUEWOk/iHxbZj2 X-Received: by 2002:a05:6214:19c2:b0:6a0:cea1:1d1d with SMTP id j2-20020a05621419c200b006a0cea11d1dmr346781qvc.5.1714670415791; Thu, 02 May 2024 10:20:15 -0700 (PDT) Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id u12-20020a0562141c0c00b006991eebd127si1366561qvc.407.2024.05.02.10.20.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 10:20:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-166774-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; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=PGZZtTEb; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-166774-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166774-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 845471C2236C for ; Thu, 2 May 2024 17:20:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 323FB16FF3C; Thu, 2 May 2024 17:20:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=intel.com header.i=@intel.com header.b="PGZZtTEb" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) (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 D2A042EB11; Thu, 2 May 2024 17:20:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.14 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714670408; cv=none; b=A1CcFQufdytz9KfamUaAIJsgf3TjeUhL39n/QuCgqg5IoRPV/pA2AGyGA4ebEQCAFJrH0EWPoMVLKmO+PJlBmz7tH5iIZgLxC+Ex8Shw6MdjUUc2GOwzePoKZXjxOnJQ3uJWTtQO9WW4W45z9mS8drzrgYemAscDt/A9saPEWqg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714670408; c=relaxed/simple; bh=H1r0dFqw/FdPrkaepk5MGTXmiIihWSraJ3Ov/oH+da0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=PQkwPW3LL4rmcFPWoFyNp/K5hzWgJq5idEd1xYHwbJSfVxtPz+XtSC/qwDRbNtdrslqthuDhpr3ZYFBZmSh+5VTXDW/xOTI/FWOcjk2VzRihHSvj5XjG7+zqgYoB5pd2738HYyhtaEOtmpmyal69HW4tvb4hT6DVfVhdleQnBRI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=PGZZtTEb; arc=none smtp.client-ip=192.198.163.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714670407; x=1746206407; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=H1r0dFqw/FdPrkaepk5MGTXmiIihWSraJ3Ov/oH+da0=; b=PGZZtTEbFu92asBvm4whCR6akWTrRynjGP1lm/5hUVUpZw9W00Fph4s9 RlHZfWHkF9ThpsMjcOihmH1aUEmZ7buRFBjp+AOIVgA84BAOJlF6wK6bk HbaYXPp1cBAWrloNm5TiR5ctOvHBT2ukFYOvmM3vpS9OhdOzquNIVllzI hg4UahUWzqVUYNPxZU3mkNosYCeSoorop+F9UU89CeuiyzBrzYs6NvnBF uCAd8fROcDqQ2KZowIkZv2CNpMCNKnDcxPDHqYl/SgxCGIyghua/mjPX5 Zb6SyNr0Ozethrwk7lom6nfmpnR0e8gLEHG/+gZ0JMqUb6H2ntgTVSeqT Q==; X-CSE-ConnectionGUID: oZO9deo4Sa2KyDcGbr8pOg== X-CSE-MsgGUID: wxMmL3vdTEurMObksBOcXA== X-IronPort-AV: E=McAfee;i="6600,9927,11062"; a="10672867" X-IronPort-AV: E=Sophos;i="6.07,247,1708416000"; d="scan'208";a="10672867" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 May 2024 10:20:06 -0700 X-CSE-ConnectionGUID: GwxzvMC6RVuJch4h+jyxeQ== X-CSE-MsgGUID: oV/NS6ryRR6Jhdam4E7xMQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,247,1708416000"; d="scan'208";a="32000691" Received: from smile.fi.intel.com ([10.237.72.54]) by orviesa005.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 May 2024 10:20:04 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.97) (envelope-from ) id 1s2a6D-00000003Ogg-1sUg; Thu, 02 May 2024 20:20:01 +0300 Date: Thu, 2 May 2024 20:20:01 +0300 From: Andy Shevchenko To: Ilpo =?iso-8859-1?Q?J=E4rvinen?= Cc: Parker Newman , LKML , linux-serial , Greg Kroah-Hartman , Jiri Slaby Subject: Re: [PATCH v1 11/13] serial: 8250_exar: Use BIT() in exar_ee_read() Message-ID: References: <20240502144626.2716994-1-andriy.shevchenko@linux.intel.com> <20240502144626.2716994-12-andriy.shevchenko@linux.intel.com> <702a9145-5bc1-c765-a1fa-278702741637@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <702a9145-5bc1-c765-a1fa-278702741637@linux.intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo On Thu, May 02, 2024 at 07:08:21PM +0300, Ilpo J?rvinen wrote: > On Thu, 2 May 2024, Andy Shevchenko wrote: .. > > // Send address to read from > > - for (i = 1 << (UART_EXAR_REGB_EE_ADDR_SIZE - 1); i; i >>= 1) > > - exar_ee_write_bit(priv, (ee_addr & i)); > > + for (i = UART_EXAR_REGB_EE_ADDR_SIZE - 1; i >= 0; i--) > > + exar_ee_write_bit(priv, ee_addr & BIT(i)); > > > > // Read data 1 bit at a time > > for (i = 0; i <= UART_EXAR_REGB_EE_DATA_SIZE; i++) { > > - data <<= 1; > > - data |= exar_ee_read_bit(priv); > > + if (exar_ee_read_bit(priv)) > > + data |= BIT(i); > > Does this end up reversing the order of bits? In the original, data was left > shifted which moved the existing bits and added the lsb but the replacement > adds highest bit on each iteration? Oh, seems a good catch! I was also wondering, but missed this somehow. Seems the EEPROM is in BE mode, so two loops has to be aligned. -- With Best Regards, Andy Shevchenko