Re: [PATCH] hamradio: baycom: use new parport device model

2017-09-17 Thread Thomas Sailer

Acked-By: Thomas Sailer 

Am 17.09.2017 um 13:46 schrieb Sudip Mukherjee:

Modify baycom driver to use the new parallel port device model.

Signed-off-by: Sudip Mukherjee 
---

Not tested on real hardware, only tested on qemu and verified that the
device is binding to the driver properly in epp_open but then unbinding
as the device was not found.

  drivers/net/hamradio/baycom_epp.c | 50 +++
  1 file changed, 46 insertions(+), 4 deletions(-)

diff --git a/drivers/net/hamradio/baycom_epp.c 
b/drivers/net/hamradio/baycom_epp.c
index 1503f10..1e62d00 100644
--- a/drivers/net/hamradio/baycom_epp.c
+++ b/drivers/net/hamradio/baycom_epp.c
@@ -840,6 +840,7 @@ static int epp_open(struct net_device *dev)
unsigned char tmp[128];
unsigned char stat;
unsigned long tstart;
+   struct pardev_cb par_cb;

  if (!pp) {
  printk(KERN_ERR "%s: parport at 0x%lx unknown\n", bc_drvname, 
dev->base_addr);
@@ -859,8 +860,21 @@ static int epp_open(struct net_device *dev)
  return -EIO;
}
memset(&bc->modem, 0, sizeof(bc->modem));
-bc->pdev = parport_register_device(pp, dev->name, NULL, epp_wakeup,
-  NULL, PARPORT_DEV_EXCL, dev);
+   memset(&par_cb, 0, sizeof(par_cb));
+   par_cb.wakeup = epp_wakeup;
+   par_cb.private = (void *)dev;
+   par_cb.flags = PARPORT_DEV_EXCL;
+   for (i = 0; i < NR_PORTS; i++)
+   if (baycom_device[i] == dev)
+   break;
+
+   if (i == NR_PORTS) {
+   pr_err("%s: no device found\n", bc_drvname);
+   parport_put_port(pp);
+   return -ENODEV;
+   }
+
+   bc->pdev = parport_register_dev_model(pp, dev->name, &par_cb, i);
parport_put_port(pp);
  if (!bc->pdev) {
  printk(KERN_ERR "%s: cannot register parport at 0x%lx\n", 
bc_drvname, pp->base);
@@ -1185,6 +1199,23 @@ MODULE_LICENSE("GPL");
  
  /* - */
  
+static int baycom_epp_par_probe(struct pardevice *par_dev)

+{
+   struct device_driver *drv = par_dev->dev.driver;
+   int len = strlen(drv->name);
+
+   if (strncmp(par_dev->name, drv->name, len))
+   return -ENODEV;
+
+   return 0;
+}
+
+static struct parport_driver baycom_epp_par_driver = {
+   .name = "bce",
+   .probe = baycom_epp_par_probe,
+   .devmodel = true,
+};
+
  static void __init baycom_epp_dev_setup(struct net_device *dev)
  {
struct baycom_state *bc = netdev_priv(dev);
@@ -1204,10 +1235,15 @@ static void __init baycom_epp_dev_setup(struct 
net_device *dev)
  
  static int __init init_baycomepp(void)

  {
-   int i, found = 0;
+   int i, found = 0, ret;
char set_hw = 1;
  
  	printk(bc_drvinfo);

+
+   ret = parport_register_driver(&baycom_epp_par_driver);
+   if (ret)
+   return ret;
+
/*
 * register net devices
 */
@@ -1241,7 +1277,12 @@ static int __init init_baycomepp(void)
found++;
}
  
-	return found ? 0 : -ENXIO;

+   if (found == 0) {
+   parport_unregister_driver(&baycom_epp_par_driver);
+   return -ENXIO;
+   }
+
+   return 0;
  }
  
  static void __exit cleanup_baycomepp(void)

@@ -1260,6 +1301,7 @@ static void __exit cleanup_baycomepp(void)
printk(paranoia_str, "cleanup_module");
}
}
+   parport_unregister_driver(&baycom_epp_par_driver);
  }
  
  module_init(init_baycomepp);






Re: [PATCH] net: hamradio: baycom_ser_fdx: Replace timeval with timespec64

2016-02-10 Thread Thomas Sailer

Reviewed-by: Thomas Sailer 

Thanks!



Re: [RESEND]: RNDIS host: adjust MTU instead of refusing to talk to devices with MTU < 1.5k

2007-10-09 Thread Thomas Sailer
On Tue, 2007-10-09 at 08:18 -0700, David Brownell wrote:

> > This patch makes the host RNDIS driver talk to RNDIS devices with an MTU
> > less than 1.5k, instead of refusing to talk to such a device.
> > Please apply.
> >
> > Signed-Off-by: Thomas Sailer <[EMAIL PROTECTED]>
> 
> Acked-by: David Brownell <[EMAIL PROTECTED]>
> 
> ... but patches in drivers/net go to netdev, not linux-usb-devel.
> And it'd be nice if the patch comment mentioned some particular
> device that's been observed to act this way.

Ok, next try.

The device in question is a low power radio device that speaks the
bpqether protocol over ethernet. bpqether frames are never longer than
320 bytes, so there is no need to support 1.5kbyte MTU in the device
firmware.

Tom

Signed-Off-by: Thomas Sailer <[EMAIL PROTECTED]>

--- 1/drivers/net/usb/rndis_host.c.orig 2007-09-04 17:51:11.0 +0200
+++ 2/drivers/net/usb/rndis_host.c  2007-09-04 17:54:26.0 +0200
@@ -512,11 +512,18 @@
}
tmp = le32_to_cpu(u.init_c->max_transfer_size);
if (tmp < dev->hard_mtu) {
-   dev_err(&intf->dev,
-   "dev can't take %u byte packets (max %u)\n",
-   dev->hard_mtu, tmp);
-   retval = -EINVAL;
-   goto fail_and_release;
+   if (tmp <= net->hard_header_len) {
+   dev_warn(&intf->dev,
+"dev can't take %u byte packets (max %u)\n",
+net->hard_header_len+1, tmp);
+   retval = -EINVAL;
+   goto fail_and_release;
+   }
+   dev->hard_mtu = tmp;
+   net->mtu = dev->hard_mtu - net->hard_header_len;
+   dev_warn(&intf->dev,
+"dev can't take %u byte packets (max %u), adjusting 
MTU to %u\n",
+dev->hard_mtu, tmp, net->mtu);
}
 
/* REVISIT:  peripheral "alignment" request is ignored ... */


-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] - drivers/net/hamradio remove local random function, use random32()

2007-02-19 Thread Thomas Sailer
On Fri, 2007-02-16 at 09:42 -0800, Joe Perches wrote:

> Signed-off-by: Joe Perches <[EMAIL PROTECTED]>
Acked-By: Thomas Sailer <[EMAIL PROTECTED]>

Thanks a lot!

Tom


-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [HAMRADIO] Replace local random function with random32()

2007-02-16 Thread Thomas Sailer
On Fri, 2007-02-16 at 11:55 +, Ralf Baechle wrote:
> Signed-off-by: Joe Perches <[EMAIL PROTECTED]>
> Signed-off-by: Ralf Baechle <[EMAIL PROTECTED]>
Acked-by: Thomas Sailer <[EMAIL PROTECTED]>


-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] - drivers/net/hamradio remove local random function, use random32()

2007-02-16 Thread Thomas Sailer
On Thu, 2007-02-15 at 19:36 -0800, Joe Perches wrote:
> remove local random function, use random32() instead
> 
> Signed-off-by: Joe Perches <[EMAIL PROTECTED]>

Acked-By: Thomas Sailer <[EMAIL PROTECTED]>

There are a bunch of other drivers with their homegrown random number
function, namely 6pack.c dmascc.c hdlcdrv.c yam.c.

Can you do a patch for those too?

Thanks a lot,

Tom



-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html