linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: rishi gupta <gupt21@gmail.com>
To: Greg KH <gregkh@linuxfoundation.org>
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
Date: Fri, 10 Jan 2020 13:08:25 +0530	[thread overview]
Message-ID: <CALUj-gvroB_N34i-QkqT6Qn1ccvif+phN+Kszf-NO6v=Q8syqg@mail.gmail.com> (raw)
In-Reply-To: <20200110072051.GA124387@kroah.com>

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 <gregkh@linuxfoundation.org> 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

  reply	other threads:[~2020-01-10  7:38 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-06  7:21 [PATCH v1 0/3] Add virtual serial null modem emulation driver Rishi Gupta
2020-01-06  7:21 ` [PATCH v1 1/3] dt-bindings: ttyvs: document serial null modem driver dt bindings Rishi Gupta
2020-01-06  7:21 ` [PATCH v1 2/3] tty/serial: ttvys: add null modem driver emulating serial port Rishi Gupta
2020-01-06 19:35   ` Greg KH
2020-01-09  9:29     ` rishi gupta
2020-01-10  7:20       ` Greg KH
2020-01-10  7:38         ` rishi gupta [this message]
2020-01-10  7:42           ` Greg KH
2020-02-10 15:14         ` rishi gupta
2020-02-12 20:02           ` Greg KH
2020-01-06 21:20   ` kbuild test robot
2020-01-06  7:21 ` [PATCH v1 3/3] tty: documentation: abi: add ttyvs null modem driver sysfs nodes Rishi Gupta
2020-01-06 19:29   ` Greg KH
2020-01-09  9:22     ` rishi gupta
2020-01-06 19:28 ` [PATCH v1 0/3] Add virtual serial null modem emulation driver Greg KH
2020-01-09  9:22   ` rishi gupta
2020-01-06 20:23 ` H. Peter Anvin
2020-01-06 22:06   ` Grant Edwards

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CALUj-gvroB_N34i-QkqT6Qn1ccvif+phN+Kszf-NO6v=Q8syqg@mail.gmail.com' \
    --to=gupt21@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).