Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1474890

Re: [PATCH v2 1/7] [media] rc-main: assign driver type during allocation

Path csiph.com!feeder.erje.net!1.us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From Andi Shyti <andi.shyti@samsung.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 1/7] [media] rc-main: assign driver type during allocation
Date Fri, 02 Sep 2016 07:30:02 +0200
Message-ID <scPd8-3He-3@gated-at.bofh.it> (permalink)
References <scHIB-79t-9@gated-at.bofh.it> <scHIB-79t-11@gated-at.bofh.it> <scPd8-3He-5@gated-at.bofh.it> <scHID-79t-49@gated-at.bofh.it>
X-Original-To Sean Young <sean@mess.org>
X-Auditid cbfee68e-f79cb6d000006cfe-79-57c90d3ab4dd
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
User-Agent NeoMutt/ (1.7.0)
X-Brightmail-Tracker H4sIAAAAAAAAA+NgFlrLIsWRmVeSWpSXmKPExsWyRsSkQNea92S4wbuzTBaLfzxnsph/5Byr xeVdc9gsejZsZbVYev0ik8XqZxUWrXuPsFssfPqdxYHDY828NYwe15d8YvbYtKqTzWPJG2uP Lf132T0+b5ILYIvisklJzcksSy3St0vgyvi7ditjwUvBimsf+RsY7/N0MXJySAiYSJy9dpEd whaTuHBvPVsXIxeHkMAKRolJuy8ywRRNn9wDlVjKKPHifRMThPORUWLd6/eMIFUsAqoSr7/M YQWx2QQ0JZpu/2ADsUUE5CS+bWthBWlgFvjGKPG/ZztYQlggWGL2tllgu3kFbCVu3j7ECDH1 NaPE1EerWCESghI/Jt9jAbGZBbQk1u88zgRhS0s8+jsDrJkT6L4Vq1rArhAVkJHo3LYO7DwJ gXvsEn1tD1ggzhOQ+Db5EJDNAZSQldh0gBniN0mJgytusExgFJuFZN0sJOtmIVm3gJF5FaNo akFyQXF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zU1MLUotg+pg4OKUa GNsjLxlslrl6afepR699Ozc4GHl2qq6JLpj24uBm9WV/O3y8rPhqGFiTPy0/wHFn1wy9wgsc N6adsO0tWXnGWdVm+vl3eivuPYr8WmhU9s/s+33dbBNxYWZzx47Mk5b3atuYJ87yVLhb3Jdk cv+s5ZI7P88+f7QmKMOFveZglfqmqfwT1dP4niqxFGckGmoxFxUnAgDt0wqcDQMAAA==
Dlp-Filter Pass
X-Mtr 20000000000000000@CPGS
X-Cfilter-Loop Reflected
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 78
Organization linux.* mail to news gateway
X-Original-Cc Mauro Carvalho Chehab <mchehab@osg.samsung.com>, Rob Herring <robh+dt@kernel.org>, Mark Rutland <mark.rutland@arm.com>, linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Andi Shyti <andi@etezian.org>
X-Original-Date Fri, 02 Sep 2016 14:25:14 +0900
X-Original-Message-ID <20160902052514.fmjk4mrhblztthzb@samsunx.samsung>
X-Original-References <20160901171629.15422-1-andi.shyti@samsung.com> <20160901171629.15422-2-andi.shyti@samsung.com> <CGME20160901212401epcas1p398150b4d46215d868997016db430c3c8@epcas1p3.samsung.com> <20160901212351.GB22198@gofer.mess.org>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1474890

Show key headers only | View raw


Hi Sean,

> >  	ir = kzalloc(sizeof(*ir), GFP_KERNEL);
> > -	dev = rc_allocate_device();
> > +	dev = rc_allocate_device(RC_DRIVER_IR_RAW);
> >  	if (!ir || !dev)
> >  		goto err_out_free;
> >  
> 
> If ir->sampling = 0 then it should be RC_DRIVER_SCANCODE.
> 
> 
> > @@ -481,7 +481,6 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
> >  	dev->scancode_mask = hardware_mask;
> >  
> >  	if (ir->sampling) {
> > -		dev->driver_type = RC_DRIVER_IR_RAW;
> >  		dev->timeout = 10 * 1000 * 1000; /* 10 ms */
> >  	} else {
> >  		dev->driver_type = RC_DRIVER_SCANCODE;
> 
> That assignment shouldn't really be there any more.

I think this doesn't change the driver's behavior, because I
either do like:

  -   dev = rc_allocate_device();
  +   dev = rc_allocate_device(RC_DRIVER_SCANCODE);

  [ ... ]

      if (ir->sampling) {
              dev->driver_type = RC_DRIVER_IR_RAW;
              dev->timeout = 10 * 1000 * 1000; /* 10 ms */
      } else {
   -          dev->driver_type = RC_DRIVER_SCANCODE;

Or I would need to do aftr the long switch...case statement

    +  if (ir->sampling) {
    +          dev = rc_allocate_device(RC_DRIVER_IR_RAW);
    +          ...
    +  } else {
    +          dev = rc_allocate_device(RC_DRIVER_SCANCODE);
    +          ...

I prefered the first way because it doesn't alter much the
driver.

> >  	ir = kzalloc(sizeof(*ir), GFP_KERNEL);
> > -	rc = rc_allocate_device();
> > +	rc = rc_allocate_device(RC_DRIVER_SCANCODE);
> >  	if (!ir || !rc) {
> >  		err = -ENOMEM;
> >  		goto err_out_free;
> 
> This is not correct, I'm afraid. If you look at the code you can see that
> if raw_decode is true, then it should be RC_DRIVER_IR_RAW.

Same here, the driver doesn't change the behavior. raw_decode can
be both 'true' or 'false' it's set as default RC_DRIVER_SCANCODE
and depending on value of raw_decode it's chaged to
RC_DRIVER_IR_RAW.

also in this case I can do

    +  if (raw_decode) {
    +          rc = rc_allocate_device(RC_DRIVER_IR_RAW);
    +          ...
    +  } else {
    +          rc = rc_allocate_device(RC_DRIVER_SCANCODE);
    +          ...

but also in this case my original approach doesn't add much
changes.

Thanks,
Andi

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH v2 1/7] [media] rc-main: assign driver type during allocation Andi Shyti <andi.shyti@samsung.com> - 2016-09-01 23:30 +0200
  Re: [PATCH v2 1/7] [media] rc-main: assign driver type during  allocation Sean Young <sean@mess.org> - 2016-09-01 23:30 +0200
    Re: [PATCH v2 1/7] [media] rc-main: assign driver type during  allocation Andi Shyti <andi.shyti@samsung.com> - 2016-09-02 07:30 +0200

csiph-web