From patchwork Fri Dec 15 17:36:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 849277 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; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="BYQ/XymJ"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3yyyKf0ySJz9ryk for ; Sat, 16 Dec 2017 04:36:54 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755550AbdLORgx (ORCPT ); Fri, 15 Dec 2017 12:36:53 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:35233 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755506AbdLORgw (ORCPT ); Fri, 15 Dec 2017 12:36:52 -0500 Received: by mail-wm0-f68.google.com with SMTP id f9so19186715wmh.0; Fri, 15 Dec 2017 09:36:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:cc:message-id:date:user-agent:mime-version :content-transfer-encoding; bh=Qon58rGymwzPK/FnuAwIShf2BlpzJ3Dub0NF8kIdV9o=; b=BYQ/XymJV2JOaEtDeOvmkAM+93Jwb27b7IPpIXrHkhspxk8q8YhJf0eEp/PmA8C8u7 qYgnUtdBZLg3XUb+y+DYP6RjkkMM+o9LMKdR4+mDNvXa0pzKG2TQKMXLErTZFsUCM0nY xP5IiSkYDbtdPdRDC5+Tnz4/ISpMy1ndAX59//B8mm/ePmo6Z+mvmhQprCE9N+MeKrt5 siI3RRU2az/xgQF8g2bo1O8fDiZNuMuaEq26M6LS4deqC+/dsoYvVqwG82zBR2di/zZR 1D6J5DlswCWNZE0CbbDY8HJLCECRCwgZ9KMZ5Cn0VylJR512Yk//eyysEpfJs+GGUqp3 xlJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:message-id:date:user-agent :mime-version:content-transfer-encoding; bh=Qon58rGymwzPK/FnuAwIShf2BlpzJ3Dub0NF8kIdV9o=; b=Ob9zWHj60ubbkL83FEgnGScFjHT5KZUTi/xf4+Z9Ra1eo1zUUl70Q2/hQ7XZHqJs60 iWA/xRYDS5Oj75vj5HX8EUkKV2MVGfcBUHBnJZ9q17uHluTR/CFZtet6eGQTKd9sjER5 PygDaRh5gD2L4J7oz2CwdV+7tiKUhVN4Qwab19+9O/BEVdwHWw5hadlexICLCT3VI6Pz NS1/jt+e9ny1PHy2mj7nRd5ih/7WcglQNqCHlIO9g93+5M4LxeOSjwGDdIA8qe9c87WB nNxaRPvv+kEWjokcJxT50lOBuM9PZsRsu/ON9fpO4hXwy+hDKGvKXeSulQpg01bcznW8 011w== X-Gm-Message-State: AKGB3mKpr5hL94WXrArKKzTZCYh80HFgMEfgdVZ0wZsOPs9Fwg18eywn r7oF7zytkIlLqSTnAT2CU4Itpw== X-Google-Smtp-Source: ACJfBotYQzkxLOiNZNIysUWTPRtEaUfz3GRk3oS2sew6nZh9zthgCabL/WgN6kXSbxXhxGFcz6/CHw== X-Received: by 10.80.177.72 with SMTP id l8mr18286400edd.175.1513359410539; Fri, 15 Dec 2017 09:36:50 -0800 (PST) Received: from ?IPv6:2003:ea:8bc0:e400:b0d3:a11f:88fd:f202? (p200300EA8BC0E400B0D3A11F88FDF202.dip0.t-ipconnect.de. [2003:ea:8bc0:e400:b0d3:a11f:88fd:f202]) by smtp.googlemail.com with ESMTPSA id n3sm6129187edb.46.2017.12.15.09.36.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Dec 2017 09:36:49 -0800 (PST) From: Heiner Kallweit Subject: [PATCH v4 0/3] i2c: introduce devm_i2c_new_dummy and use it in at24 driver To: Bartosz Golaszewski , Wolfram Sang , Peter Rosin Cc: "linux-i2c@vger.kernel.org" , Linux Kernel Mailing List Message-ID: <083569b1-489a-d84f-1a87-bca52fad53e1@gmail.com> Date: Fri, 15 Dec 2017 18:36:42 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org i2c_new_dummy is typically called from the probe function of the driver for the primary i2c client. It requires calls to i2c_unregister_device in the error path of the probe function and in the remove function. This can be simplified by introducing a device-managed version. Make at24 driver the first user of the new function. Changes in v2: - add change to i2c core to make a version of i2c_new_device available which returns an ERR_PTR instead of NULL in error case - few minor improvements Changes in v3: - rename _i2c_new_device to __i2c_new_device Changes in v4: - add missing kernel doc comments - add Reviewed-by Heiner Kallweit (3): i2c: core: improve return value handling of i2c_new_device and i2c_new_dummy i2c: core: add device-managed version of i2c_new_dummy eeprom: at24: switch to device-managed version of i2c_new_dummy Documentation/driver-model/devres.txt | 3 + drivers/i2c/i2c-core-base.c | 108 ++++++++++++++++++++++++++++++---- drivers/misc/eeprom/at24.c | 31 ++++------ include/linux/i2c.h | 3 + 4 files changed, 112 insertions(+), 33 deletions(-)