/* This function checks if the PS/2 transmitter is empty and sends a byte. Otherwise it returns error. Transmission fails only when nothing is connected to the PS/2 port. Thats why, we do not try to resend the data in case of a failure.  */
static int sxps2_write(struct serio *pserio, unsigned char c)
/* This function checks if the PS/2 transmitter is empty and sends a byte. Otherwise it returns error. Transmission fails only when nothing is connected to the PS/2 port. Thats why, we do not try to resend the data in case of a failure.  */
static int sxps2_write(struct serio *pserio, unsigned char c)
{
	struct xps2data *drvdata = pserio->port_data;
	unsigned long flags;
	u32 sr;
	int status = -1;
	spin_lock_irqsave(&drvdata->lock, flags);
	sr = in_be32(drvdata->base_address + XPS2_STATUS_OFFSET);
	if (!(sr & XPS2_STATUS_TX_FULL)) {
		out_be32(drvdata->base_address + XPS2_TX_DATA_OFFSET, c);
		status = 0;
	}
	spin_unlock_irqrestore(&drvdata->lock, flags);
	return status;
}