Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp84284pxu; Thu, 3 Dec 2020 20:29:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJxgELEzOxeOl5zG1bpjlUq+dhw1J6nMGzfuEGC4ia93LwzgVav85XAIuq80WfEr0AEFQ4LA X-Received: by 2002:a17:906:b745:: with SMTP id fx5mr5306067ejb.103.1607056172765; Thu, 03 Dec 2020 20:29:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607056172; cv=none; d=google.com; s=arc-20160816; b=t8LD1t3aYlkVYqD0GWwKpuWmgu6/JaBPDAaSI6zRf0jb+MbjmIf5hhe5qbb0Mo+v9o XUHPI0L4/lIQyXVxogwNv9jJr42C9hdQOfybxiK6aMi0iDeF8NSm4kb+vNHzpz85G/br 2iOiUIskfuzYIoxRxebWJZnnynPCFew6WpcC/g0Ucpqp/Yc+SZlgezCk/vU5Fo/wicRC caXyt6dpXrfrmXQwxnr6Bz+s+NiTclwMJ0Cq4zwDeR9wtJFNpbeFMtu5HC18cEL7FpQB CCDeMa++COaIL64NneEFMJAyqLu8oui/ZWO4blSr+QuBC334J/7qnCOv7FIXOXX3gQHI Epug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature:dkim-signature; bh=ueqfytZa4DvF6pbdA0i4fHWAEJB7VMiSIbX4mjQgh6E=; b=Hkv/gNUbo6QYcM1m8iU1ZrGAaWOLMEzDq+3aAkDGoNF+pj5mdW38Q3KiJlefqXE/1V eJI3VmN7eBFjI9jLE5+LI9rsq3QSEPQf2gGRhSQl26LdnjwYYlcnnxpEugsVmt1JfCqE 5GBzWmAjrLr+iQa9zRC2OQH/xayYixFnRM63e7pKJhK4Q1IYKqxO6eJN9HxQ/kAv45cy lNcblZqZlZGd8ims4RYu+7h+tNU3wCGVNmcdF2qsZxOq8eFCAK+MH2M/xkc7ExdTbCNO whiLB6VgLC+/hcDpZEMWS1vujG4p8Uvu2YIFfxkrhGf4uQYI3MJKy85eXJWlH4zagL8G U5fA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pobox.com header.s=sasl header.b=m0is3nlr; dkim=pass header.i=@fluxnic.net header.s=2016-12.pbsmtp header.b="aFsxI2/I"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hp24si685162ejc.590.2020.12.03.20.29.07; Thu, 03 Dec 2020 20:29:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@pobox.com header.s=sasl header.b=m0is3nlr; dkim=pass header.i=@fluxnic.net header.s=2016-12.pbsmtp header.b="aFsxI2/I"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726912AbgLDEYw (ORCPT + 99 others); Thu, 3 Dec 2020 23:24:52 -0500 Received: from pb-smtp21.pobox.com ([173.228.157.53]:61229 "EHLO pb-smtp21.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726038AbgLDEYw (ORCPT ); Thu, 3 Dec 2020 23:24:52 -0500 Received: from pb-smtp21.pobox.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id 8ED61111CA9; Thu, 3 Dec 2020 23:24:10 -0500 (EST) (envelope-from nico@fluxnic.net) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=date:from:to :cc:subject:in-reply-to:message-id:references:mime-version :content-type; s=sasl; bh=3PN7+dhj56TpvZ/QEmMRDjeq+70=; b=m0is3n lruKj+Mxrr/Ats9nNhNbId/4G3c7o7OhzbO4GO80amr33WkTNd3QewIw09HcRYqi dmFrAXQ34iCyu4gBw/KKD1voM4ynH2ot8KF/kwVMuemR4jTnglXk0xMpbKqARAYb onWn2VQsZehT0bTW3OQHSuNlwwiiHBEkKEzSk= Received: from pb-smtp21.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id 87245111CA8; Thu, 3 Dec 2020 23:24:10 -0500 (EST) (envelope-from nico@fluxnic.net) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=fluxnic.net; h=date:from:to:cc:subject:in-reply-to:message-id:references:mime-version:content-type; s=2016-12.pbsmtp; bh=wYsG55wCwVlnNuBZDyuyP9nA7lynkKBaXTgh1MoGBCI=; b=aFsxI2/INdj5cIUuXWogCLdJzLhU0oioyHZ+MFEWed4sdGZzUsq4RgR1P+ijrntXMY8fpDG845udCAnI6oQhf3pV0P0yXhn+OVnr01oaYm3G77W/9SnQvX80kjgEibf+lhGGRID1HQ6wQcrw1aSHqJUPSH5e9I5tptJ3AY8Bpms= Received: from yoda.home (unknown [24.203.50.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp21.pobox.com (Postfix) with ESMTPSA id 65654111CA7; Thu, 3 Dec 2020 23:24:07 -0500 (EST) (envelope-from nico@fluxnic.net) Received: from xanadu.home (xanadu.home [192.168.2.2]) by yoda.home (Postfix) with ESMTPSA id 9844F2DA0639; Thu, 3 Dec 2020 23:24:05 -0500 (EST) Date: Thu, 3 Dec 2020 23:24:05 -0500 (EST) From: Nicolas Pitre To: Parshuram Thombare cc: alexandre.belloni@bootlin.com, slongerbeam@gmail.com, vitor.soares@synopsys.com, praneeth@ti.com, mparab@cadence.com, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v10 2/7] i3c: master: use i3c_master_register only for main master In-Reply-To: <1606717066-3785-1-git-send-email-pthombar@cadence.com> Message-ID: <2s3n7419-1nr9-8885-882o-7qrsos6qq6q@syhkavp.arg> References: <1606716983-3645-1-git-send-email-pthombar@cadence.com> <1606717066-3785-1-git-send-email-pthombar@cadence.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Pobox-Relay-ID: 8CB4D5B0-35E8-11EB-87AA-D609E328BF65-78420484!pb-smtp21.pobox.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 30 Nov 2020, Parshuram Thombare wrote: > Removed last argument 'secondary' and restructured i3c_master_register > to move code that can be common to i3c_secondary_master_register > to separate function i3c_master_init. > > Signed-off-by: Parshuram Thombare [...] > +static int i3c_master_init(struct i3c_master_controller *master, > + struct device *parent, > + const struct i3c_master_controller_ops *ops, > + bool secondary) > { > unsigned long i2c_scl_rate = I3C_BUS_I2C_FM_PLUS_SCL_RATE; > struct i3c_bus *i3cbus = i3c_master_get_bus(master); > @@ -2535,10 +2514,49 @@ int i3c_master_register(struct i3c_master_controller *master, > goto err_put_dev; > } > > - ret = i3c_master_bus_init(master); > + ret = i3c_primary_master_bus_init(master); > if (ret) > goto err_destroy_wq; > > + return 0; > + > +err_destroy_wq: > + destroy_workqueue(master->wq); > + > +err_put_dev: > + put_device(&master->dev); > + > + return ret; > +} [...] > +int i3c_primary_master_register(struct i3c_master_controller *master, > + struct device *parent, > + const struct i3c_master_controller_ops *ops) > +{ > + int ret; > + > + ret = i3c_master_init(master, parent, ops, false); > + if (ret) > + return ret; > + > ret = device_add(&master->dev); > if (ret) > goto err_cleanup_bus; > @@ -2568,15 +2586,13 @@ int i3c_master_register(struct i3c_master_controller *master, > err_cleanup_bus: > i3c_master_bus_cleanup(master); > > -err_destroy_wq: > destroy_workqueue(master->wq); > > -err_put_dev: > put_device(&master->dev); > > return ret; > } This looks a bit confusing. Here you're rolling back detailss in i3c_primary_master_register() that were factored out in i3c_master_init(). If i3c_master_init() is successful, then you shouldn't be undoing its things openly in i3c_primary_master_register(). Instead, there should be another function that does the reverse of i3c_master_init() here. Nicolas