aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/algos/i2c-algo-bit.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/i2c/algos/i2c-algo-bit.c')
-rw-r--r--drivers/i2c/algos/i2c-algo-bit.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c
index fcef6ff3d287..fc16f9d268a3 100644
--- a/drivers/i2c/algos/i2c-algo-bit.c
+++ b/drivers/i2c/algos/i2c-algo-bit.c
@@ -540,7 +540,7 @@ static const struct i2c_algorithm i2c_bit_algo = {
540/* 540/*
541 * registering functions to load algorithms at runtime 541 * registering functions to load algorithms at runtime
542 */ 542 */
543int i2c_bit_add_bus(struct i2c_adapter *adap) 543static int i2c_bit_prepare_bus(struct i2c_adapter *adap)
544{ 544{
545 struct i2c_algo_bit_data *bit_adap = adap->algo_data; 545 struct i2c_algo_bit_data *bit_adap = adap->algo_data;
546 546
@@ -558,10 +558,33 @@ int i2c_bit_add_bus(struct i2c_adapter *adap)
558 adap->timeout = 100; /* default values, should */ 558 adap->timeout = 100; /* default values, should */
559 adap->retries = 3; /* be replaced by defines */ 559 adap->retries = 3; /* be replaced by defines */
560 560
561 return 0;
562}
563
564int i2c_bit_add_bus(struct i2c_adapter *adap)
565{
566 int err;
567
568 err = i2c_bit_prepare_bus(adap);
569 if (err)
570 return err;
571
561 return i2c_add_adapter(adap); 572 return i2c_add_adapter(adap);
562} 573}
563EXPORT_SYMBOL(i2c_bit_add_bus); 574EXPORT_SYMBOL(i2c_bit_add_bus);
564 575
576int i2c_bit_add_numbered_bus(struct i2c_adapter *adap)
577{
578 int err;
579
580 err = i2c_bit_prepare_bus(adap);
581 if (err)
582 return err;
583
584 return i2c_add_numbered_adapter(adap);
585}
586EXPORT_SYMBOL(i2c_bit_add_numbered_bus);
587
565MODULE_AUTHOR("Simon G. Vogl <simon@tk.uni-linz.ac.at>"); 588MODULE_AUTHOR("Simon G. Vogl <simon@tk.uni-linz.ac.at>");
566MODULE_DESCRIPTION("I2C-Bus bit-banging algorithm"); 589MODULE_DESCRIPTION("I2C-Bus bit-banging algorithm");
567MODULE_LICENSE("GPL"); 590MODULE_LICENSE("GPL");