Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp367052ybl; Thu, 9 Jan 2020 23:39:47 -0800 (PST) X-Google-Smtp-Source: APXvYqz7EtyeS0l3JDdzMeJyh4hTIeOfSFtXZRlCrnqdib8FeYv+UUzsAAPLVMpKLumUAne/ENcW X-Received: by 2002:a05:6830:1e67:: with SMTP id m7mr1529709otr.262.1578641987411; Thu, 09 Jan 2020 23:39:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578641987; cv=none; d=google.com; s=arc-20160816; b=PkH4+OdaGBNAHJd5b0zV6IXE636GTk/WZoCutNQ7oCQjw6vgxgtquLjoSTGq+ka10c Z8ihIqemcTDKZBnpdBZCYcCeRhiKX5xxGmi0SwSZIh+K0j+T6mUNJAkZ/QGu1F18bri4 wGU7D6+oAMkNqmEa3dJIkCIdVnALarSOx8GLGSgcSFcOWojAK2IugGLITXDdz9uVsuyE zkOHRJCKXf48M9u8nvDfH6u/CQoMrseDh8l5u3UBUQZji0D/KJPPjQy7k1+aEodgeQeU XntbStEBjy52Y3xqaUCq7FlhrdU5k7gEU5Q/eeNtFPR9QtWgOdZxb3bOJhMw27kUK8f0 CrFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=frOmwgpbYCqHF+EYUPe13bnygy2tqNJcGXBXPNFxpL4=; b=hDo065E+AYdIQaUevjHezmzHNwYI4HqLl5UFDTd093ANC4wn++0p3heUYeicNwOCpd /LDzizSpJmomyAP9Mk9UrN84qnMqPe25ipB9GV3MvqaFchY/Pbc92tyUlgmQkpM6byNG UFJkosrpoOGWWL3Mt8dPggPDrEC+cPTJ6VTS2QEmxR7FhbwFs4ZfLyN/R95i4Een/GQd q/ZRuqLvotjgoWhMK6n6DsnhNnQkRDmk1woD31Ms6PQfur/XytMHh8FaYUYcYHZc8z5m o5xt/FI3khffetBr3/4K6JSUAdVuw1Is8QCmsJpcZ98aY3kIk4a7aaqQKYGJFq4P36Fx 8P5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=H19G2bGb; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z1si748317otq.21.2020.01.09.23.39.36; Thu, 09 Jan 2020 23:39:47 -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=@gmail.com header.s=20161025 header.b=H19G2bGb; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726801AbgAJHih (ORCPT + 99 others); Fri, 10 Jan 2020 02:38:37 -0500 Received: from mail-qk1-f196.google.com ([209.85.222.196]:43722 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726551AbgAJHih (ORCPT ); Fri, 10 Jan 2020 02:38:37 -0500 Received: by mail-qk1-f196.google.com with SMTP id t129so1005740qke.10; Thu, 09 Jan 2020 23:38:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=frOmwgpbYCqHF+EYUPe13bnygy2tqNJcGXBXPNFxpL4=; b=H19G2bGbuiDimXZSWVXQfRFQhdPBnJ9jrafNYbpdI/2xS6HUtXFqgBm9U56PpTpq6x 4PLlmNMHn8G9SgNwMvW627xgmR60VzCNdrhKNjrIdIgil/Hr5P95RBhiMKGAPkGsnu5E bM/YlUr4T/jifTdWudVpQiiclLrMh1HUL7tS4J2jbtTp3PVfzd2PJgfrH63w2rfZI2XO gbyOTAnWa82V7wcX8cr+nEpfpEfRF2q+9lOxx7ICRkrjs4yqetjyGMBlVJ+1o/oGccLa rImES/t2DgdekgdaJ18U043vYskSW3XJZlaiYe/RnK2g3Cxeuz0qhB6mlH0e+9+8fI+j tumA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=frOmwgpbYCqHF+EYUPe13bnygy2tqNJcGXBXPNFxpL4=; b=OO2PuC1DqgdiWo9+Oqb01sr3+EQj7EDYq5dlaauic0SJeCV/UFi1NZo5riJhvwMvIl dOLb10LnQdirdzyUFlxc4A83Za0hxCirfU/iI8E9HM+axLakIayHYU8udMkPnmFXZ/ut +2NJGBUDkG2kChyeY/id7GwJEA9Ohu6D8dD6LW5E4RmriC21/9FX+447osd/kCBAduyN BaPVs8CE1NpT2KRz/KgnKz16ngX2piS1oQhwhfZQj3ysb+Ov5kK1+AygTbsd0qW+vcVe 1syjJHB774K8vt84mXbh+1Ewa+UTrI4WL2k+ltT7b8Fl0eVT1JIbmqlW5WcFBqkco5G4 KXyQ== X-Gm-Message-State: APjAAAWDKfBaLd586l8r8AucW+XMxX6FDPg8EIRGxorAp2Voh2rzUYNs NUi5vlp1ludmYrq8EqKeZtDBKSllyCxgXHB6CQE= X-Received: by 2002:ae9:c316:: with SMTP id n22mr1821462qkg.72.1578641916111; Thu, 09 Jan 2020 23:38:36 -0800 (PST) MIME-Version: 1.0 References: <9fcb02fafd5fc9b31f3fe358b8e62b8a40ae132a.1578235515.git.gupt21@gmail.com> <20200106193500.GC754821@kroah.com> <20200110072051.GA124387@kroah.com> In-Reply-To: <20200110072051.GA124387@kroah.com> From: rishi gupta Date: Fri, 10 Jan 2020 13:08:25 +0530 Message-ID: Subject: Re: [PATCH v1 2/3] tty/serial: ttvys: add null modem driver emulating serial port To: Greg KH Cc: robh+dt@kernel.org, jslaby@suse.com, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org One problem (: about configfs. Desktop distros like Ubuntu doesn't enable configFS by default in kernel config. So users will have to build their own version of kernel. For my own purpose, as developer I have control over this but for others building kernel suggested ? On Fri, Jan 10, 2020 at 12:50 PM Greg KH wrote: > > 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. Okay understood. > > > > > +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