@@ -841,6 +841,68 @@ static void free_pardevice(struct device *dev)
841841 kfree (par_dev );
842842}
843843
844+ /**
845+ * parport_register_dev_model - register a device on a parallel port
846+ * @port: port to which the device is attached
847+ * @name: a name to refer to the device
848+ * @par_dev_cb: struct containing callbacks
849+ * @id: device number to be given to the device
850+ *
851+ * This function, called by parallel port device drivers,
852+ * declares that a device is connected to a port, and tells the
853+ * system all it needs to know.
854+ *
855+ * The struct pardev_cb contains pointer to callbacks. preemption
856+ * callback function, @preempt, is called when this device driver
857+ * has claimed access to the port but another device driver wants
858+ * to use it. It is given, @private, as its parameter, and should
859+ * return zero if it is willing for the system to release the port
860+ * to another driver on its behalf. If it wants to keep control of
861+ * the port it should return non-zero, and no action will be taken.
862+ * It is good manners for the driver to try to release the port at
863+ * the earliest opportunity after its preemption callback rejects a
864+ * preemption attempt. Note that if a preemption callback is happy
865+ * for preemption to go ahead, there is no need to release the
866+ * port; it is done automatically. This function may not block, as
867+ * it may be called from interrupt context. If the device driver
868+ * does not support preemption, @preempt can be %NULL.
869+ *
870+ * The wake-up ("kick") callback function, @wakeup, is called when
871+ * the port is available to be claimed for exclusive access; that
872+ * is, parport_claim() is guaranteed to succeed when called from
873+ * inside the wake-up callback function. If the driver wants to
874+ * claim the port it should do so; otherwise, it need not take
875+ * any action. This function may not block, as it may be called
876+ * from interrupt context. If the device driver does not want to
877+ * be explicitly invited to claim the port in this way, @wakeup can
878+ * be %NULL.
879+ *
880+ * The interrupt handler, @irq_func, is called when an interrupt
881+ * arrives from the parallel port. Note that if a device driver
882+ * wants to use interrupts it should use parport_enable_irq(),
883+ * and can also check the irq member of the parport structure
884+ * representing the port.
885+ *
886+ * The parallel port (lowlevel) driver is the one that has called
887+ * request_irq() and whose interrupt handler is called first.
888+ * This handler does whatever needs to be done to the hardware to
889+ * acknowledge the interrupt (for PC-style ports there is nothing
890+ * special to be done). It then tells the IEEE 1284 code about
891+ * the interrupt, which may involve reacting to an IEEE 1284
892+ * event depending on the current IEEE 1284 phase. After this,
893+ * it calls @irq_func. Needless to say, @irq_func will be called
894+ * from interrupt context, and may not block.
895+ *
896+ * The %PARPORT_DEV_EXCL flag is for preventing port sharing, and
897+ * so should only be used when sharing the port with other device
898+ * drivers is impossible and would lead to incorrect behaviour.
899+ * Use it sparingly! Normally, @flags will be zero.
900+ *
901+ * This function returns a pointer to a structure that represents
902+ * the device on the port, or %NULL if there is not enough memory
903+ * to allocate space for that structure.
904+ **/
905+
844906struct pardevice *
845907parport_register_dev_model (struct parport * port , const char * name ,
846908 const struct pardev_cb * par_dev_cb , int id )
0 commit comments