aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/algos/i2c-algo-bit.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c
index a39e6cff86e7..938170b8998b 100644
--- a/drivers/i2c/algos/i2c-algo-bit.c
+++ b/drivers/i2c/algos/i2c-algo-bit.c
@@ -600,7 +600,8 @@ static const struct i2c_algorithm i2c_bit_algo = {
600/* 600/*
601 * registering functions to load algorithms at runtime 601 * registering functions to load algorithms at runtime
602 */ 602 */
603static int i2c_bit_prepare_bus(struct i2c_adapter *adap) 603static int __i2c_bit_add_bus(struct i2c_adapter *adap,
604 int (*add_adapter)(struct i2c_adapter *))
604{ 605{
605 struct i2c_algo_bit_data *bit_adap = adap->algo_data; 606 struct i2c_algo_bit_data *bit_adap = adap->algo_data;
606 607
@@ -614,30 +615,18 @@ static int i2c_bit_prepare_bus(struct i2c_adapter *adap)
614 adap->algo = &i2c_bit_algo; 615 adap->algo = &i2c_bit_algo;
615 adap->retries = 3; 616 adap->retries = 3;
616 617
617 return 0; 618 return add_adapter(adap);
618} 619}
619 620
620int i2c_bit_add_bus(struct i2c_adapter *adap) 621int i2c_bit_add_bus(struct i2c_adapter *adap)
621{ 622{
622 int err; 623 return __i2c_bit_add_bus(adap, i2c_add_adapter);
623
624 err = i2c_bit_prepare_bus(adap);
625 if (err)
626 return err;
627
628 return i2c_add_adapter(adap);
629} 624}
630EXPORT_SYMBOL(i2c_bit_add_bus); 625EXPORT_SYMBOL(i2c_bit_add_bus);
631 626
632int i2c_bit_add_numbered_bus(struct i2c_adapter *adap) 627int i2c_bit_add_numbered_bus(struct i2c_adapter *adap)
633{ 628{
634 int err; 629 return __i2c_bit_add_bus(adap, i2c_add_numbered_adapter);
635
636 err = i2c_bit_prepare_bus(adap);
637 if (err)
638 return err;
639
640 return i2c_add_numbered_adapter(adap);
641} 630}
642EXPORT_SYMBOL(i2c_bit_add_numbered_bus); 631EXPORT_SYMBOL(i2c_bit_add_numbered_bus);
643 632