From patchwork Fri Sep 26 10:55:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 4981601 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 47F4B9F2BB for ; Fri, 26 Sep 2014 10:59:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8407F2016C for ; Fri, 26 Sep 2014 10:58:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A6ADC2021A for ; Fri, 26 Sep 2014 10:58:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755149AbaIZK6w (ORCPT ); Fri, 26 Sep 2014 06:58:52 -0400 Received: from mail-lb0-f174.google.com ([209.85.217.174]:63831 "EHLO mail-lb0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754874AbaIZK6h (ORCPT ); Fri, 26 Sep 2014 06:58:37 -0400 Received: by mail-lb0-f174.google.com with SMTP id l4so14057002lbv.5 for ; Fri, 26 Sep 2014 03:58:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=IqroeUZAtBhgVRGjWPttCtJH6yIKNGNvH5jWHHsIDFU=; b=NRyX8QS1uXDGol4OC7sr+EPQyS8gCpefl2Xg9+M+Pw+JUj4WuOeEHpHC/7cMpX9DzU edBK9Ia9HwEmoQXQREj+HVcCcRshvLTMf4z0fYEPr/67imhMW9c+lMsz4cr+bFG/JzAg ECppsfy9nuD8CrxkEWttcqVvmW85Qxh/ew1PvyUVn+qj9qntNnBt0H+Ii/FjD3QtVFTg tcP2KdHTKOw3ed6upevGTfweF82s8NSCFylRde8wZI3tiHol+kmYJkj2LHkRC4an182r bCyc/C7dwcl0eiqRaLhvsFmvHO7ZY0aFI2j8GR2yq9hipW4T5qLOd851qKvXTG53+/w1 BXKg== X-Received: by 10.152.4.97 with SMTP id j1mr19342441laj.73.1411729115747; Fri, 26 Sep 2014 03:58:35 -0700 (PDT) Received: from xi.terra (s83-177-171-8.cust.tele2.se. [83.177.171.8]) by mx.google.com with ESMTPSA id y5sm1771452laa.20.2014.09.26.03.58.33 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Sep 2014 03:58:35 -0700 (PDT) X-Google-Original-Sender: Received: from johan by xi.terra with local (Exim 4.80.1) (envelope-from ) id 1XXTBs-0003UU-Mb; Fri, 26 Sep 2014 12:55:56 +0200 From: Johan Hovold To: Samuel Ortiz , Lee Jones Cc: Jiri Kosina , linux-input@vger.kernel.org, Greg Kroah-Hartman , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Johan Hovold Subject: [PATCH 6/6] mfd: core: fix platform-device id generation Date: Fri, 26 Sep 2014 12:55:33 +0200 Message-Id: <1411728933-13351-7-git-send-email-johan@kernel.org> X-Mailer: git-send-email 1.8.5.5 In-Reply-To: <1411728933-13351-1-git-send-email-johan@kernel.org> References: <1411728933-13351-1-git-send-email-johan@kernel.org> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Make sure to always honour multi-function devices registered with PLATFORM_DEVID_NONE (-1) or PLATFORM_DEVID_AUTO (-2) as id base. In this case it does not make sense to append the cell id to the mfd-id base and potentially change the requested behaviour. Specifically this will allow multi-function devices to be registered with PLATFORM_DEVID_AUTO while still having non-zero cell ids. Signed-off-by: Johan Hovold --- drivers/mfd/mfd-core.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c index 892d343193ad..79f25633d7db 100644 --- a/drivers/mfd/mfd-core.c +++ b/drivers/mfd/mfd-core.c @@ -87,9 +87,15 @@ static int mfd_add_device(struct device *parent, int id, struct platform_device *pdev; struct device_node *np = NULL; int ret = -ENOMEM; + int platform_id; int r; - pdev = platform_device_alloc(cell->name, id + cell->id); + if (id < 0) + platform_id = id; + else + platform_id = id + cell->id; + + pdev = platform_device_alloc(cell->name, platform_id); if (!pdev) goto fail_alloc;