Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp907534ybl; Thu, 12 Dec 2019 06:48:02 -0800 (PST) X-Google-Smtp-Source: APXvYqyfLj4Xnfu6ZzR2Gp+wfr68RjUmaosfXjFX37sp6X3b9V/Ckp+QKH8oIfI1Hufl69gYi4rR X-Received: by 2002:a05:6830:1744:: with SMTP id 4mr1792666otz.71.1576162082544; Thu, 12 Dec 2019 06:48:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576162082; cv=none; d=google.com; s=arc-20160816; b=lNfRAQMkjmULbHLkPGakoGMFudSldDMD8Ig2MFvOgE8Mf92RyeC+izgeTKaprFh0WN sZh9bX5/EsioVSpAMLpQzBgyP2/i7sJXoAE4XKazeoKEirbrh8j72FxvAA8JHkKNKwKh qSzdJfccsfxIGacWhdsLv/H09HKMzMth4oFBHvAiLi3LcxC+eNxnp5PWx81Rf/cYI2Ly G2SxqClwW4fMbDJ4lmCz6kdJ1j9w/0nehoPBj3YOiNdvGnp9/7FeYOrUvaswJciH9zp3 fRDD4xbErJQkbpvP87Jjc+jb8qryL1bqzkXYZqTg2SLWetKlzAOea3OtcxUvOgsx77jz ldzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=R4gcplb3xCu1YCqBx9GC+oGDPPpb99wtedDOYJ7Hk7Y=; b=sQBRkqzV3xMyWvHlnilJjUH32ogePkI3KmFQRKF80xGQRdGKgO7IqnokkeUr/6589Y Y4S8DLFsywzQwH0J6A+NAJd+qLs2cz2fXmr4ODqbOIWGsZ9aJYcT/nTStbBiJ+P0VJ8I wmp/OV/Y//9scwiBOAO1WDIDXQ5KvqoaneZiWVbT/w0tZmMYep3A7mYuuip4S1r3ZqAy Hh+3ilxhGVW1g0MYv13QMduW1/92qOSoVKkwKkpnbqCko92X9TAT+huP/G3Ipfm646bl Z54M3+2CoH0NJsm4I2TiAcdZJrWlC7oGTyeVt//oQ+Bscm5JxryvRbxteOVI2JK5gAdY mzrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Q9ZKtIix; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w18si3091661otl.54.2019.12.12.06.47.47; Thu, 12 Dec 2019 06:48:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Q9ZKtIix; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729655AbfLLOqa (ORCPT + 99 others); Thu, 12 Dec 2019 09:46:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:58728 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729266AbfLLOqa (ORCPT ); Thu, 12 Dec 2019 09:46:30 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 595D222527; Thu, 12 Dec 2019 14:46:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576161989; bh=LQ+QqJke3k2uOefv9MNRRbl/t4c8KgxsP2Atg7f46Sk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Q9ZKtIix0AD1Yhhr/dobmWey6VrOfRRFSLp1tg88whojYHHs/V2riyUdxMolNs+ll Y5DdjM60CyH5pmEfLudLH3sPFfCghNUCcaP1I0fIBps6GudlXY30fjd36i6JNKkEMS aZ6zJ8oFrGyKefLK6NNuQ+OtUgv/+M/qbJsY3q+E= Date: Thu, 12 Dec 2019 15:46:27 +0100 From: Greg KH To: Vitor Soares Cc: linux-kernel@vger.kernel.org, linux-i3c@lists.infradead.org, Joao.Pinto@synopsys.com, bbrezillon@kernel.org, wsa@the-dreams.de, arnd@arndb.de, broonie@kernel.org Subject: Re: [RFC 5/5] i3c: add i3cdev module to expose i3c dev in /dev Message-ID: <20191212144627.GC1668196@kroah.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 10, 2019 at 04:37:33PM +0100, Vitor Soares wrote: > +static struct i3cdev_data *i3cdev_get_by_minor(unsigned int minor) Why? Why not just embed the structure in the cdev if you really need it? > +static struct i3cdev_data *get_free_i3cdev(struct i3c_device *i3c) > +{ > + struct i3cdev_data *i3cdev; > + unsigned long minor; > + > + minor = find_first_zero_bit(minors, N_I3C_MINORS); No locking, fun!!! :( Why not use an idr instead, that is what it is there for. Don't try to roll your own. thanks, greg k-h