X-Git-Url: https://git.karo-electronics.de/?a=blobdiff_plain;f=drivers%2Fextcon%2Fextcon-sm5502.c;h=b0f7bd82af90436d7e433a7350f80195f57d7e52;hb=88a29e668da61196ab1abae9b7434d35428e17ef;hp=560d7dccec7b25a0886d8b8ef696608478b2aa67;hpb=a6aacbde406eeb6f8fc218b2c6172825f5e73fcf;p=karo-tx-linux.git diff --git a/drivers/extcon/extcon-sm5502.c b/drivers/extcon/extcon-sm5502.c index 560d7dccec7b..b0f7bd82af90 100644 --- a/drivers/extcon/extcon-sm5502.c +++ b/drivers/extcon/extcon-sm5502.c @@ -8,16 +8,10 @@ * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. */ #include #include -#include #include #include #include @@ -26,7 +20,8 @@ #include #include #include -#include + +#include "extcon-sm5502.h" #define DELAY_MS_DEFAULT 17000 /* unit: millisecond */ @@ -300,7 +295,7 @@ static unsigned int sm5502_muic_get_cable_type(struct sm5502_muic_info *info) * If ADC is SM5502_MUIC_ADC_GROUND(0x0), external cable hasn't * connected with to MUIC device. */ - cable_type &= SM5502_REG_ADC_MASK; + cable_type = adc & SM5502_REG_ADC_MASK; if (cable_type == SM5502_MUIC_ADC_GROUND) return SM5502_MUIC_ADC_GROUND; @@ -395,7 +390,7 @@ static int sm5502_muic_cable_handler(struct sm5502_muic_info *info, /* Get the type of attached or detached cable */ if (attached) cable_type = sm5502_muic_get_cable_type(info); - else if (!attached) + else cable_type = prev_cable_type; prev_cable_type = cable_type; @@ -457,8 +452,6 @@ static void sm5502_muic_irq_work(struct work_struct *work) dev_err(info->dev, "failed to handle MUIC interrupt\n"); mutex_unlock(&info->mutex); - - return; } /* @@ -617,8 +610,9 @@ static int sm5022_muic_i2c_probe(struct i2c_client *i2c, IRQF_NO_SUSPEND, muic_irq->name, info); if (ret) { - dev_err(info->dev, "failed: irq request (IRQ: %d," - " error :%d)\n", muic_irq->irq, ret); + dev_err(info->dev, + "failed: irq request (IRQ: %d, error :%d)\n", + muic_irq->irq, ret); return ret; } }