Date:2010-07-12 22:00:15 (13 years 5 months ago)
Author:Lars C.
Commit:e0afb2562ebaf0439fc641440e77cbaff3480e6e
Message:MMC: jz4740: Add some style cleanups

Files: drivers/mmc/host/jz4740_mmc.c (7 diffs)

Change Details

drivers/mmc/host/jz4740_mmc.c
384384        tmp = readw(host->base + JZ_REG_MMC_RESP_FIFO);
385385        for (i = 0; i < 4; ++i) {
386386            cmd->resp[i] = tmp << 24;
387            cmd->resp[i] |= readw(host->base + JZ_REG_MMC_RESP_FIFO) << 8;
387            tmp = readw(host->base + JZ_REG_MMC_RESP_FIFO);
388            cmd->resp[i] |= tmp << 8;
388389            tmp = readw(host->base + JZ_REG_MMC_RESP_FIFO);
389390            cmd->resp[i] |= tmp >> 8;
390391        }
...... 
664665{
665666    struct jz4740_mmc_host *host = devid;
666667
667    mmc_detect_change(host->mmc, HZ / 3);
668    mmc_detect_change(host->mmc, HZ / 2);
668669
669670    return IRQ_HANDLED;
670671}
...... 
692693    JZ_GPIO_BULK_PIN(MSC_DATA3),
693694};
694695
696static int __devinit jz4740_mmc_request_gpio(struct device *dev, int gpio,
697    const char *name, bool output, int value)
698{
699    int ret;
700
701    if (!gpio_is_valid(gpio))
702        return 0;
703
704    ret = gpio_request(gpio, name);
705    if (ret) {
706        dev_err(dev, "Failed to request %s gpio: %d\n", name, ret);
707        return ret;
708    }
709
710    if (output)
711        gpio_direction_output(gpio, value);
712    else
713        gpio_direction_input(gpio);
714
715    return 0;
716}
717
695718static int __devinit jz4740_mmc_request_gpios(struct platform_device *pdev)
696719{
697720    int ret;
...... 
700723    if (!pdata)
701724        return 0;
702725
703    if (gpio_is_valid(pdata->gpio_card_detect)) {
704        ret = gpio_request(pdata->gpio_card_detect, "MMC detect change");
705        if (ret) {
706            dev_err(&pdev->dev, "Failed to request detect change gpio\n");
707            goto err;
708        }
709        gpio_direction_input(pdata->gpio_card_detect);
710    }
726    ret = jz4740_mmc_request_gpio(&pdev->dev, pdata->gpio_card_detect,
727            "MMC detect change", false, 0);
728    if (ret)
729        goto err;
711730
712    if (gpio_is_valid(pdata->gpio_read_only)) {
713        ret = gpio_request(pdata->gpio_read_only, "MMC read only");
714        if (ret) {
715            dev_err(&pdev->dev, "Failed to request read only gpio: %d\n", ret);
716            goto err_free_gpio_card_detect;
717        }
718        gpio_direction_input(pdata->gpio_read_only);
719    }
731    ret = jz4740_mmc_request_gpio(&pdev->dev, pdata->gpio_read_only,
732            "MMC read only", false, 0);
733    if (ret)
734        goto err_free_gpio_card_detect;
720735
721    if (gpio_is_valid(pdata->gpio_power)) {
722        ret = gpio_request(pdata->gpio_power, "MMC power");
723        if (ret) {
724            dev_err(&pdev->dev, "Failed to request power gpio: %d\n", ret);
725            goto err_free_gpio_read_only;
726        }
727        gpio_direction_output(pdata->gpio_power, pdata->power_active_low);
728    }
736    ret = jz4740_mmc_request_gpio(&pdev->dev, pdata->gpio_power,
737            "MMC read only", true, pdata->power_active_low);
738    if (ret)
739        goto err_free_gpio_read_only;
729740
730741    return 0;
731742
...... 
739750    return ret;
740751}
741752
753static int __devinit jz4740_mmc_request_cd_irq(struct platform_device *pdev,
754    struct jz4740_mmc_host *host)
755{
756    int ret;
757    struct jz4740_mmc_platform_data *pdata = pdev->dev.platform_data;
758
759    if (gpio_is_valid(pdata->gpio_card_detect))
760        return 0;
761
762    host->card_detect_irq = gpio_to_irq(pdata->gpio_card_detect);
763
764    if (host->card_detect_irq < 0) {
765        dev_warn(&pdev->dev, "Failed to get card detect irq\n");
766        return 0;
767    }
768    return request_irq(host->card_detect_irq, jz4740_mmc_card_detect_irq,
769            IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
770            "MMC card detect", host);
771
772
773    return ret;
774}
775
742776static void jz4740_mmc_free_gpios(struct platform_device *pdev)
743777{
744778    struct jz4740_mmc_platform_data *pdata = pdev->dev.platform_data;
...... 
848882    spin_lock_init(&host->lock);
849883    host->irq_mask = 0xffff;
850884
851    host->card_detect_irq = gpio_to_irq(pdata->gpio_card_detect);
852
853    if (host->card_detect_irq < 0) {
854        dev_warn(&pdev->dev, "Failed to get irq for card detect gpio\n");
855    } else {
856        ret = request_irq(host->card_detect_irq,
857            jz4740_mmc_card_detect_irq,
858            IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
859            "MMC card detect", host);
860
861        if (ret) {
862            dev_err(&pdev->dev, "Failed to request card detect irq");
863            goto err_free_gpios;
864        }
885    ret = jz4740_mmc_request_cd_irq(pdev, host);
886    if (ret) {
887        dev_err(&pdev->dev, "Failed to request card detect irq\n");
888        goto err_free_gpios;
865889    }
866890
867891    ret = request_threaded_irq(host->irq, jz_mmc_irq, jz_mmc_irq_worker,
...... 
875899    jz4740_mmc_clock_disable(host);
876900    setup_timer(&host->timeout_timer, jz4740_mmc_timeout,
877901            (unsigned long)host);
878    /* It is not that important when it times out, it just needs to timeout. */
902    /* It is not important when it times out, it just needs to timeout. */
879903    set_timer_slack(&host->timeout_timer, HZ);
880904
881905    platform_set_drvdata(pdev, host);

Archive Download the corresponding diff file



interactive