Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751118AbdFTQes (ORCPT ); Tue, 20 Jun 2017 12:34:48 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:43193 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750925AbdFTQer (ORCPT ); Tue, 20 Jun 2017 12:34:47 -0400 Subject: Re: [PATCH linux] drivers/fsi: Add SBEFIFO FSI client device driver To: gregkh@linuxfoundation.org References: <6363b930-6a69-daf7-c1b5-b1e5ccbc5170@linux.vnet.ibm.com> From: Eddie James Cc: linux-kernel , Brad Bishop , Jeremy Kerr , Christopher Bostic , Joel Stanley , Andrew Jeffery Date: Tue, 20 Jun 2017 11:34:41 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 MIME-Version: 1.0 In-Reply-To: <6363b930-6a69-daf7-c1b5-b1e5ccbc5170@linux.vnet.ibm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-TM-AS-GCONF: 00 x-cbid: 17062016-0036-0000-0000-00000230E1BD X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007262; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000214; SDB=6.00877516; UDB=6.00437144; IPR=6.00657654; BA=6.00005432; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00015900; XFM=3.00000015; UTC=2017-06-20 16:34:45 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17062016-0037-0000-0000-000040CC42A9 Message-Id: <930fe55f-bdf1-a2b7-a96b-d9077a3fc302@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-06-20_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1706200286 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1354 Lines: 41 On 06/15/2017 5:24 AM, gregkh@linuxfoundation.org wrote: > On Wed, Jun 14, 2017 at 02:47:27PM -0500, Edward A. James wrote: >> +struct sbefifo { >> + struct timer_list poll_timer; >> + struct fsi_device *fsi_dev; >> + struct miscdevice mdev; >> + wait_queue_head_t wait; >> + struct list_head link; >> + struct list_head xfrs; >> + struct kref kref; >> + spinlock_t lock; >> + char name[32]; >> + int idx; >> + int rc; >> +}; > > You have a misc device, a pointer to a fsi_device, and a kref in this > structure. Which one actually does the reference counting? It seems > there are 3 different ways it could happen. That's not right at all, > and ripe for lots and lots of confusion. Only use one please. Thanks for the comments, the problem here is that there is no way to init the miscdevice device kobject with a kobj_type. So we'd have to just do raw kref get/put there so we can get our release function. Does any other linux driver use miscdevice for reference counting? I couldn't find anything. It seems cleaner to me to have our own kref. The fsi_dev is really a parent device, so we shouldn't use that for reference counting. What do you think? I can add comments to make things clearer? Thanks, Eddie > > thanks, > > greg k-h >