From patchwork Fri Apr 13 17:42:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Hansen X-Patchwork-Id: 898050 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-i2c-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="qx+gg0g0"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40N4sJ3WWRz9ryr for ; Sat, 14 Apr 2018 03:44:20 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750940AbeDMRoS (ORCPT ); Fri, 13 Apr 2018 13:44:18 -0400 Received: from mail-ot0-f201.google.com ([74.125.82.201]:55430 "EHLO mail-ot0-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751776AbeDMRnM (ORCPT ); Fri, 13 Apr 2018 13:43:12 -0400 Received: by mail-ot0-f201.google.com with SMTP id d13-v6so5497681otc.22 for ; Fri, 13 Apr 2018 10:43:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:date:in-reply-to:message-id:references:subject:from:to :cc; bh=hKxJhawwzbYRxsHsQcSrUslS6fC9ujgoX5pHxaifmXA=; b=qx+gg0g0sw+6VGNH53p2chQTtTfY/kJ/VSSZbq5sGtAw10hZG5lfUQOUVPs+TPBp2h B7S1eN/HsaHyb9GnDaDkU+mqsbbmSdl1ETKLA6uRxdgWdALE6jd0PCz6yuXVH6WcMQbi UwAJZUw5Fug9JQOn+IwuDvkwFBCo7u1frCk91j8HhCdjlkZDx0xcgPzA6PXpqcTEIU40 KOswMmymBSg2CcB2LEQBThVosyVNTNG+PDajPlQWXEPGGbaldo3Qj7OsUSicX/ZWLCZI AKfLCqMbtddbnmZvXJ8b9PedlhjPoGWepYRZCROrzRRCEfjPXBrd1Wgp7aBxaXn8ObmR ZmDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:date:in-reply-to:message-id :references:subject:from:to:cc; bh=hKxJhawwzbYRxsHsQcSrUslS6fC9ujgoX5pHxaifmXA=; b=pFlpgvlUSr8uGzG0TlSCoQhbt4bzCjJ1tqpS20OhiYC78Yakm8aIXprYwGaKpB++Bw kuWz8JDrdVe0WE19QbJpwh8809pFOjNiRXf3eal2yohilxTFhoOl3wweQsQA2hBdpP2n wPhf/A/dtMZy3hG5BRWeJIl12FuswUjWkL11Q59oyyWLlvTydzAzXQQf96b0h8o5W5Ta tBMGWdTAWQd0/5mANcZh/I16psC6MTo5J5kj6XeN5bLfU2eS0jL+x/A2X6MWm5nuGBk/ alJZY5NyJ3zlXcLY2RPfq9arTCQeUjCi1rtl2SLHsMfYe2aA1bzuexTxh1qA9856Znkn RRrg== X-Gm-Message-State: ALQs6tAqhVzNwQbqyEEaIoXGWXqx1rwo0bEgKjrCTxggRFZ1M6LU4yua gweqYDU7TKWSlfKYKbJeTk+sto2/svPF75LJMaknAr6d+crKZ7kok56izxIjyAXLs6jBx8dpHsy kS3+qvhKSia4ubTqYS2Ykka30imA+onJyfH5wusvf7dXYkECFoKRpLuht0gFWFEvWTwN1 X-Google-Smtp-Source: AIpwx48txAh4PDZtm9qwqIDsxAUPXWGBPTqZy5bvbyr51YV+ZWxkouD9EdCgw/342lDF+o99ZzEsaMlAeu3v MIME-Version: 1.0 X-Received: by 2002:a9d:1a1a:: with SMTP id a26-v6mr2742424ote.117.1523641392060; Fri, 13 Apr 2018 10:43:12 -0700 (PDT) Date: Fri, 13 Apr 2018 10:42:56 -0700 In-Reply-To: <20180413174257.139182-1-hansens@google.com> Message-Id: <20180413174257.139182-2-hansens@google.com> References: <20180413174257.139182-1-hansens@google.com> X-Mailer: git-send-email 2.17.0.484.g0c8726318c-goog Subject: [PATCH v3 2/3] Documentation/i2c: sync docs with current state of i2c-tools From: Sam Hansen To: linux-i2c@vger.kernel.org, hansens@google.com, wsa@the-dreams.de, corbet@lwn.net, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Sam Hansen , wsa@the-dreams.de, corbet@lwn.net, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Currently, Documentation/i2c/dev-interface describes the use of i2c_smbus_* helper routines as static inlined functions provided by linux/i2c-dev.h. Work has been done to refactor the linux/i2c-dev.h file in the i2c-tools project out into its own library. As a result, these docs have become stale. This patch corrects the discrepancy and directs the reader to the i2c-tools project for more information. Signed-off-by: Sam Hansen --- No changes from v2. Documentation/i2c/dev-interface | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/Documentation/i2c/dev-interface b/Documentation/i2c/dev-interface index c8737d502791..f92ee1f59914 100644 --- a/Documentation/i2c/dev-interface +++ b/Documentation/i2c/dev-interface @@ -23,11 +23,6 @@ First, you need to include these two headers: #include #include -(Please note that there are two files named "i2c-dev.h" out there. One is -distributed with the Linux kernel and the other one is included in the -source tree of i2c-tools. They used to be different in content but since 2012 -they're identical. You should use "linux/i2c-dev.h"). - Now, you have to decide which adapter you want to access. You should inspect /sys/class/i2c-dev/ or run "i2cdetect -l" to decide this. Adapter numbers are assigned somewhat dynamically, so you can not @@ -140,8 +135,8 @@ ioctl(file, I2C_RDWR, struct i2c_rdwr_ioctl_data *msgset) set in each message, overriding the values set with the above ioctl's. ioctl(file, I2C_SMBUS, struct i2c_smbus_ioctl_data *args) - Not meant to be called directly; instead, use the access functions - below. + If possible, use the provided i2c_smbus_* methods described below instead + of issuing direct ioctls. You can do plain i2c transactions by using read(2) and write(2) calls. You do not need to pass the address byte; instead, set it through @@ -166,10 +161,9 @@ what happened. The 'write' transactions return 0 on success; the returns the number of values read. The block buffers need not be longer than 32 bytes. -The above functions are all inline functions, that resolve to calls to -the i2c_smbus_access function, that on its turn calls a specific ioctl -with the data in a specific format. Read the source code if you -want to know what happens behind the screens. +The above functions are made available by linking against the libi2c library, +which is provided by the i2c-tools project. See: +https://git.kernel.org/pub/scm/utils/i2c-tools/i2c-tools.git/. Implementation details