Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp353836ybl; Thu, 9 Jan 2020 23:22:08 -0800 (PST) X-Google-Smtp-Source: APXvYqxIJhB1qHLjPBlFJlZnmYfWElxYZmy+eGYOnUNc7zBoTVvuEc+3sUZ/6xKfYlQJRJA/cVBW X-Received: by 2002:a05:6808:aba:: with SMTP id r26mr1144806oij.4.1578640927955; Thu, 09 Jan 2020 23:22:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578640927; cv=none; d=google.com; s=arc-20160816; b=cmd7iIXr0ZKiLfCS6SdHQ19hS3sqAP9A2srX+WYP2Rl7oj+nLyItO/8KgYgxJEZGgs ot0fKGbMyPNP2cKfIU/HgAeSVzed56Au84PD0ZODStDGESAsB2lGXSxn0kaEj6I7udVs 4mgqtyUmp0AdE0ZrULL6YObrDzjLCXPO0/EwoWADUThev5ncD7xy9A8MkjH1T9B18xq8 39CitKeiiYM6YRDPS4j0FMbooluXY/YT39mw+1vYhQaHHqAA5zWNkOV9ZtzmOS0VX5Ws PHF8MI3X8B4F0ai6YG9mToI+zHHd0rYQ3Yv8FRTAHOJ3TA108SKLDSuVKAGtNhXHiYEe efKQ== 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=vEhxCdpgYT00O2Q2SBf8H5Wu8/rRPs5i6ES3k385Eiw=; b=OaV3G2wR9mlGHyutROkjyiEXpgbby0nvFJbT6JF8gj/V+WL4JmySLg0Av28L6Yuhe2 EMZi8vA7I/nZfNpiDVTOb0WVFnCT/R6FuOPxJDdQyIt4eEtu06i9ZJdXM336ppcvIx2W aUn/XYqr76xbhdHHu23BGyPb2CEJKzE4CPoN3ViLYRmdItQ28FwpmEzMEQ3uL3UcYggL PN6aG/tFCNzbvnEG1jEEnVr808lNLhRZW96BYwi07gBw0mCb46L+86iUJ/YbuvSfE3Z0 YnPpFChFJDPsr9TK7vx22riLzBE5b1w6lbO+9l7RP72oBxIQSgrVpPXzH9yGOSFocUcR Bw5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hyiO5Gkk; 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 b9si615113oie.20.2020.01.09.23.21.56; Thu, 09 Jan 2020 23:22:07 -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=hyiO5Gkk; 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 S1726736AbgAJHUy (ORCPT + 99 others); Fri, 10 Jan 2020 02:20:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:37674 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726558AbgAJHUy (ORCPT ); Fri, 10 Jan 2020 02:20:54 -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 45FD52080D; Fri, 10 Jan 2020 07:20:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578640853; bh=w+dk7wSpEQK4o75h7tvK6qJiWTaDhrGxQZa5wmfsJqA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=hyiO5Gkk+vOXMenZrdGwNETa59cH/wdH7h2FxA75bkVmgU6DfvH7axbASrMRVKGn8 quIHIQ4JqzIUvVrToq2e902iZuyCGo5fymJiEXBQUrwnUgjgSVlyRDowTO2TcokqZm iij2E3JBWDWveMVzUI1Wcm0TRdwH6gfiWCs4i4B4= Date: Fri, 10 Jan 2020 08:20:51 +0100 From: Greg KH To: rishi gupta Cc: robh+dt@kernel.org, jslaby@suse.com, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1 2/3] tty/serial: ttvys: add null modem driver emulating serial port Message-ID: <20200110072051.GA124387@kroah.com> References: <9fcb02fafd5fc9b31f3fe358b8e62b8a40ae132a.1578235515.git.gupt21@gmail.com> <20200106193500.GC754821@kroah.com> 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 Thu, Jan 09, 2020 at 02:59:59PM +0530, rishi gupta wrote: > > > +/* UART frame structure definitions */ > > > +#define VS_CRTSCTS 0x0001 > > > +#define VS_XON 0x0002 > > > +#define VS_NONE 0X0004 > > > +#define VS_DATA_5 0X0008 > > > +#define VS_DATA_6 0X0010 > > > +#define VS_DATA_7 0X0020 > > > +#define VS_DATA_8 0X0040 > > > > Why the "X"? > Sorry I did not understand, do you mean why VS_XON. No, I mean why the "0X0040" instead of "0x0040" like all other hex digits in your list of defines. > > > +static int vs_alloc_reg_one_dev(int oidx, int pidx, int rtsmap, > > > + int dtrmap, int dtropn) > > > +{ > > > + int ret; > > > + struct vs_dev *vsdev; > > > + struct device *dev; > > > + > > > + /* Allocate and init virtual tty device private data */ > > > + vsdev = kcalloc(1, sizeof(struct vs_dev), GFP_KERNEL); > > > + if (!vsdev) > > > + return -ENOMEM; > > > + > > > + vsdev->own_tty = NULL; > > > + vsdev->peer_tty = NULL; > > > + vsdev->own_index = oidx; > > > + vsdev->peer_index = pidx; > > > + vsdev->rts_mappings = rtsmap; > > > + vsdev->dtr_mappings = dtrmap; > > > + vsdev->set_odtr_at_open = dtropn; > > > + vsdev->msr_reg = 0; > > > + vsdev->mcr_reg = 0; > > > + vsdev->waiting_msr_chg = 0; > > > + vsdev->tx_paused = 0; > > > + vsdev->faulty_cable = 0; > > > + mutex_init(&vsdev->lock); > > > + > > > + /* Register with tty core with specific minor number */ > > > + dev = tty_register_device(ttyvs_driver, oidx, NULL); > > > + if (!dev) { > > > + ret = -ENOMEM; > > > + goto fail; > > > + } > > > + > > > + vsdev->device = dev; > > > + dev_set_drvdata(dev, vsdev); > > > + > > > + /* Create custom sysfs files for this device for events */ > > > + ret = sysfs_create_group(&dev->kobj, &vs_info_attr_grp); > > > > Please no. You just raced with userspace and lost (i.e. userspace has > > no idea these files are present.) > > > > Please use the correct apis for this, if you _REALLY_ want special sysfs > > files for a tty device. > Any specific API would you like to suggest. I am unable to progress on > how to address this one. Now that you have moved things to configfs, maybe you do not need the sysfs files anymore? Ah your "control" sysfs files, ok, you need to set the driver's dev_groups variable to point to your sysfs attributes, and then the driver core will properly set up these files. hope this helps, greg k-h