Commit c52f2ba7 authored by Sean Young's avatar Sean Young Committed by Mauro Carvalho Chehab

[media] sir_ir: remove init_chrdev and init_sir_ir functions

Inlining these functions into the probe function makes it much
more readable.
Signed-off-by: default avatarSean Young <sean@mess.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent f23f5408
......@@ -53,7 +53,6 @@ static DEFINE_SPINLOCK(hardware_lock);
/* Communication with user-space */
static void add_read_queue(int flag, unsigned long val);
static int init_chrdev(void);
/* Hardware */
static irqreturn_t sir_interrupt(int irq, void *dev_id);
static void send_space(unsigned long len);
......@@ -120,28 +119,6 @@ static void add_read_queue(int flag, unsigned long val)
ir_raw_event_store_with_filter(rcdev, &ev);
}
static int init_chrdev(void)
{
rcdev = devm_rc_allocate_device(&sir_ir_dev->dev, RC_DRIVER_IR_RAW);
if (!rcdev)
return -ENOMEM;
rcdev->input_name = "SIR IrDA port";
rcdev->input_phys = KBUILD_MODNAME "/input0";
rcdev->input_id.bustype = BUS_HOST;
rcdev->input_id.vendor = 0x0001;
rcdev->input_id.product = 0x0001;
rcdev->input_id.version = 0x0100;
rcdev->tx_ir = sir_tx_ir;
rcdev->allowed_protocols = RC_BIT_ALL_IR_DECODER;
rcdev->driver_name = KBUILD_MODNAME;
rcdev->map_name = RC_MAP_RC6_MCE;
rcdev->timeout = IR_DEFAULT_TIMEOUT;
rcdev->dev.parent = &sir_ir_dev->dev;
return devm_rc_register_device(&sir_ir_dev->dev, rcdev);
}
/* SECTION: Hardware */
static void sir_timeout(unsigned long data)
{
......@@ -323,11 +300,27 @@ static void drop_hardware(void)
}
/* SECTION: Initialisation */
static int init_sir_ir(void)
static int sir_ir_probe(struct platform_device *dev)
{
int retval;
rcdev = devm_rc_allocate_device(&sir_ir_dev->dev, RC_DRIVER_IR_RAW);
if (!rcdev)
return -ENOMEM;
rcdev->input_name = "SIR IrDA port";
rcdev->input_phys = KBUILD_MODNAME "/input0";
rcdev->input_id.bustype = BUS_HOST;
rcdev->input_id.vendor = 0x0001;
rcdev->input_id.product = 0x0001;
rcdev->input_id.version = 0x0100;
rcdev->tx_ir = sir_tx_ir;
rcdev->allowed_protocols = RC_BIT_ALL_IR_DECODER;
rcdev->driver_name = KBUILD_MODNAME;
rcdev->map_name = RC_MAP_RC6_MCE;
rcdev->timeout = IR_DEFAULT_TIMEOUT;
rcdev->dev.parent = &sir_ir_dev->dev;
setup_timer(&timerlist, sir_timeout, 0);
/* get I/O port access and IRQ line */
......@@ -343,20 +336,13 @@ static int init_sir_ir(void)
}
pr_info("I/O port 0x%.4x, IRQ %d.\n", io, irq);
init_hardware();
return 0;
}
static int sir_ir_probe(struct platform_device *dev)
{
int retval;
retval = init_chrdev();
retval = devm_rc_register_device(&sir_ir_dev->dev, rcdev);
if (retval < 0)
return retval;
return init_sir_ir();
init_hardware();
return 0;
}
static int sir_ir_remove(struct platform_device *dev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment