[LinuxPPS] ntpd

Rodolfo Giometti giometti at linux.it
Thu Aug 3 20:07:44 CEST 2006


On Thu, Aug 03, 2006 at 08:00:06PM +0200, Rodolfo Giometti wrote:
> 
> As you can see the several modules trying to register different ports
> at the same "port line"... I don't know why but this generate the
> wrong content of file /proc/pps/sources.

Now can you modify the code as follow:

   int uart_add_one_port(struct uart_driver *drv, struct uart_port *port)
   {
           struct uart_state *state;
           int ret = 0;

           BUG_ON(in_interrupt());

           if (port->line >= drv->nr)
                   return -EINVAL;

           state = drv->state + port->line;

           mutex_lock(&port_mutex);
           mutex_lock(&state->mutex);
           if (state->port) {
                   ret = -EINVAL;
                   goto out;
           }
   printk("PPS-TEST port line %d\n", port->line);

           state->port = port;

           port->cons = drv->cons;

and

   static void
   uart_configure_port(struct uart_driver *drv, struct uart_state *state,
                       struct uart_port *port)
   {
           unsigned int flags;

           /*
            * If there isn't a port here, don't do anything further.
            */
           if (!port->iobase && !port->mapbase && !port->membase)
                   return;

           /*
            * Now do the auto configuration stuff.  Note that config_port
            * is expected to claim the resources and map the port for us.
            */
           flags = UART_CONFIG_TYPE;
           if (port->flags & UPF_AUTO_IRQ)
                   flags |= UART_CONFIG_IRQ;
           if (port->flags & UPF_BOOT_AUTOCONF) {
                   port->type = PORT_UNKNOWN;
                   port->ops->config_port(port, flags);
           }

           if (port->type != PORT_UNKNOWN) {
                   unsigned long flags;

   printk("PPS-TEST2 port line %d\n", port->line);
                   uart_report_port(drv, port);

                   /*
                    * Ensure that the modem control lines are de-activated.
                    * We probably don't need a spinlock around this, but
                    */
                   spin_lock_irqsave(&port->lock, flags);

Now, we should see 8 times the message PPS-TEST but only 4 time
PPS-TEST2...

Thanks a lot,

Rodolfo

-- 

GNU/Linux Solutions                  e-mail:    giometti at enneenne.com
Linux Device Driver                             giometti at gnudd.com
Embedded Systems                     		giometti at linux.it
UNIX programming                     phone:     +39 349 2432127
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://ml.enneenne.com/pipermail/linuxpps/attachments/20060803/8df4c0c0/attachment.pgp


More information about the LinuxPPS mailing list