From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752451AbcC3FPA (ORCPT ); Wed, 30 Mar 2016 01:15:00 -0400 Received: from anchovy3.45ru.net.au ([203.30.46.155]:60945 "EHLO anchovy.45ru.net.au" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751746AbcC3FO7 (ORCPT ); Wed, 30 Mar 2016 01:14:59 -0400 Subject: Re: [PATCH] gpio: pca953x: Use correct u16 value for register word write To: Yong Li References: <1459232852-15697-1-git-send-email-sdliyong@gmail.com> <56FA6FB6.4040003@electromag.com.au> <1680089.6CCf2RWg8O@ws-stein> <56FAAE58.20004@electromag.com.au> Cc: Alexander Stein , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org From: Phil Reid Message-ID: <56FB60CC.9000605@electromag.com.au> Date: Wed, 30 Mar 2016 13:14:52 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 30/03/2016 1:01 PM, Yong Li wrote: > Or another method is using the below to convert the u8 to u16: > cpu_to_le16(get_unaligned((u16 *) val)), compared with the > i2c_smbus_write_byte_data method, which one is better? > > G'day Yong, I'd go with the cpu_to_le16(get_unaligned((u16 *) val)) -- Regards Phil Reid