extcon pull request targetting Linux 3.8 for Greg KH on 2012.11.22

This is based on Linux 3.7 rc6
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJQra3OAAoJEBOhurvWBoCKtT8P/2oQ/lB5S7Snh5LkoB7OUvmT
 pczaGGjX9ZWkrTUanuRaB2Ye3I/ctAZ7Nhg0YLPJLUZWR9AjqhzuF06LIcr26W7N
 DkVtqiURbV64b4QMYXssLS7B6YfgC7iEEwF/yf35j3HlerDG33veth98nnhHeLA5
 tLUMTtGdpMelZP2D0533Hihyu5ndl1gH1l6Qhy8Aqel2WJMqx1oZgexIRNpwUjuH
 hN1WkQH3hvrsVwDENX25nVMx3PvgngPb0006dZDtBkuHI/z0TvW7iyIOc5db/FfG
 TBZHcSciDjSTkYURu1mn60fmXdrAXWHpGCVx1ikiWQ8xQiXj3ctaxUDWJP9ZbxNb
 T4KPk5DxGg0f0OctjORRV+Q6KV0YH9d+Gig6O9AHOC8VK8LQQaGv3Mgq0PBGHW+D
 6XmtIud142VHgHqHlGMB6MLl2dno3s2mtu0Ckb79s8nMMEhzRCgY/aBc5AW3wFvz
 eGEK+X82BrSEAc4w2NiwhpqUti7W4KgQiw1S9UivEFGzqUcXX90aXFpz6SghEThd
 h5h0apoAurWorwETF8Smh2Gtp0ZBuDEgX7acWeICbnp+/Pn00rC5LNUhgd0WDHJS
 kkVq8LXW1W+VvcMZqlBRmC2x+UC0zWqnzevbyYFnXB5xxwk12ud6K1DVHUO7CWrv
 0izBUP5SwLSSCp+SAe+t
 =/KTt
 -----END PGP SIGNATURE-----

Merge tag 'pull_req_20121122' of git://git.kernel.org/pub/scm/linux/kernel/git/mzx/extcon into char-misc-next

MyungJoo writes:
 "extcon pull request targetting Linux 3.8 for Greg KH on 2012.11.22
  This is based on Linux 3.7 rc6"
This commit is contained in:
Greg Kroah-Hartman 2012-11-27 06:44:10 -08:00
commit 962b686c45
5 changed files with 56 additions and 61 deletions

View File

@ -166,6 +166,7 @@ static irqreturn_t arizona_micdet(int irq, void *data)
ret = regmap_read(arizona->regmap, ARIZONA_MIC_DETECT_3, &val); ret = regmap_read(arizona->regmap, ARIZONA_MIC_DETECT_3, &val);
if (ret != 0) { if (ret != 0) {
dev_err(arizona->dev, "Failed to read MICDET: %d\n", ret); dev_err(arizona->dev, "Failed to read MICDET: %d\n", ret);
mutex_unlock(&info->lock);
return IRQ_NONE; return IRQ_NONE;
} }

View File

@ -472,7 +472,7 @@ int extcon_register_interest(struct extcon_specific_cable_nb *obj,
obj->cable_index = extcon_find_cable_index(obj->edev, cable_name); obj->cable_index = extcon_find_cable_index(obj->edev, cable_name);
if (obj->cable_index < 0) if (obj->cable_index < 0)
return -ENODEV; return obj->cable_index;
obj->user_nb = nb; obj->user_nb = nb;

View File

@ -657,17 +657,17 @@ static int max77693_muic_probe(struct platform_device *pdev)
int ret, i; int ret, i;
u8 id; u8 id;
info = kzalloc(sizeof(struct max77693_muic_info), GFP_KERNEL); info = devm_kzalloc(&pdev->dev, sizeof(struct max77693_muic_info),
GFP_KERNEL);
if (!info) { if (!info) {
dev_err(&pdev->dev, "failed to allocate memory\n"); dev_err(&pdev->dev, "failed to allocate memory\n");
ret = -ENOMEM; return -ENOMEM;
goto err_kfree;
} }
info->dev = &pdev->dev; info->dev = &pdev->dev;
info->max77693 = max77693; info->max77693 = max77693;
if (info->max77693->regmap_muic) if (info->max77693->regmap_muic) {
dev_dbg(&pdev->dev, "allocate register map\n"); dev_dbg(&pdev->dev, "allocate register map\n");
else { } else {
info->max77693->regmap_muic = devm_regmap_init_i2c( info->max77693->regmap_muic = devm_regmap_init_i2c(
info->max77693->muic, info->max77693->muic,
&max77693_muic_regmap_config); &max77693_muic_regmap_config);
@ -675,7 +675,7 @@ static int max77693_muic_probe(struct platform_device *pdev)
ret = PTR_ERR(info->max77693->regmap_muic); ret = PTR_ERR(info->max77693->regmap_muic);
dev_err(max77693->dev, dev_err(max77693->dev,
"failed to allocate register map: %d\n", ret); "failed to allocate register map: %d\n", ret);
goto err_regmap; return ret;
} }
} }
platform_set_drvdata(pdev, info); platform_set_drvdata(pdev, info);
@ -686,11 +686,13 @@ static int max77693_muic_probe(struct platform_device *pdev)
/* Support irq domain for MAX77693 MUIC device */ /* Support irq domain for MAX77693 MUIC device */
for (i = 0; i < ARRAY_SIZE(muic_irqs); i++) { for (i = 0; i < ARRAY_SIZE(muic_irqs); i++) {
struct max77693_muic_irq *muic_irq = &muic_irqs[i]; struct max77693_muic_irq *muic_irq = &muic_irqs[i];
int virq = 0; unsigned int virq = 0;
virq = irq_create_mapping(max77693->irq_domain, muic_irq->irq); virq = irq_create_mapping(max77693->irq_domain, muic_irq->irq);
if (!virq) if (!virq) {
ret = -EINVAL;
goto err_irq; goto err_irq;
}
muic_irq->virq = virq; muic_irq->virq = virq;
ret = request_threaded_irq(virq, NULL, ret = request_threaded_irq(virq, NULL,
@ -702,14 +704,13 @@ static int max77693_muic_probe(struct platform_device *pdev)
" error :%d)\n", " error :%d)\n",
muic_irq->irq, ret); muic_irq->irq, ret);
for (i = i - 1; i >= 0; i--)
free_irq(muic_irq->virq, info);
goto err_irq; goto err_irq;
} }
} }
/* Initialize extcon device */ /* Initialize extcon device */
info->edev = kzalloc(sizeof(struct extcon_dev), GFP_KERNEL); info->edev = devm_kzalloc(&pdev->dev, sizeof(struct extcon_dev),
GFP_KERNEL);
if (!info->edev) { if (!info->edev) {
dev_err(&pdev->dev, "failed to allocate memory for extcon\n"); dev_err(&pdev->dev, "failed to allocate memory for extcon\n");
ret = -ENOMEM; ret = -ENOMEM;
@ -720,7 +721,7 @@ static int max77693_muic_probe(struct platform_device *pdev)
ret = extcon_dev_register(info->edev, NULL); ret = extcon_dev_register(info->edev, NULL);
if (ret) { if (ret) {
dev_err(&pdev->dev, "failed to register extcon device\n"); dev_err(&pdev->dev, "failed to register extcon device\n");
goto err_extcon; goto err_irq;
} }
/* Initialize MUIC register by using platform data */ /* Initialize MUIC register by using platform data */
@ -753,7 +754,7 @@ static int max77693_muic_probe(struct platform_device *pdev)
MAX77693_MUIC_REG_ID, &id); MAX77693_MUIC_REG_ID, &id);
if (ret < 0) { if (ret < 0) {
dev_err(&pdev->dev, "failed to read revision number\n"); dev_err(&pdev->dev, "failed to read revision number\n");
goto err_extcon; goto err_irq;
} }
dev_info(info->dev, "device ID : 0x%x\n", id); dev_info(info->dev, "device ID : 0x%x\n", id);
@ -765,12 +766,9 @@ static int max77693_muic_probe(struct platform_device *pdev)
return ret; return ret;
err_extcon:
kfree(info->edev);
err_irq: err_irq:
err_regmap: while (--i >= 0)
kfree(info); free_irq(muic_irqs[i].virq, info);
err_kfree:
return ret; return ret;
} }
@ -783,8 +781,6 @@ static int max77693_muic_remove(struct platform_device *pdev)
free_irq(muic_irqs[i].virq, info); free_irq(muic_irqs[i].virq, info);
cancel_work_sync(&info->irq_work); cancel_work_sync(&info->irq_work);
extcon_dev_unregister(info->edev); extcon_dev_unregister(info->edev);
kfree(info->edev);
kfree(info);
return 0; return 0;
} }

View File

@ -1,7 +1,7 @@
/* /*
* extcon-max8997.c - MAX8997 extcon driver to support MAX8997 MUIC * extcon-max8997.c - MAX8997 extcon driver to support MAX8997 MUIC
* *
* Copyright (C) 2012 Samsung Electrnoics * Copyright (C) 2012 Samsung Electronics
* Donggeun Kim <dg77.kim@samsung.com> * Donggeun Kim <dg77.kim@samsung.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -433,11 +433,11 @@ static int max8997_muic_probe(struct platform_device *pdev)
struct max8997_muic_info *info; struct max8997_muic_info *info;
int ret, i; int ret, i;
info = kzalloc(sizeof(struct max8997_muic_info), GFP_KERNEL); info = devm_kzalloc(&pdev->dev, sizeof(struct max8997_muic_info),
GFP_KERNEL);
if (!info) { if (!info) {
dev_err(&pdev->dev, "failed to allocate memory\n"); dev_err(&pdev->dev, "failed to allocate memory\n");
ret = -ENOMEM; return -ENOMEM;
goto err_kfree;
} }
info->dev = &pdev->dev; info->dev = &pdev->dev;
@ -450,14 +450,16 @@ static int max8997_muic_probe(struct platform_device *pdev)
for (i = 0; i < ARRAY_SIZE(muic_irqs); i++) { for (i = 0; i < ARRAY_SIZE(muic_irqs); i++) {
struct max8997_muic_irq *muic_irq = &muic_irqs[i]; struct max8997_muic_irq *muic_irq = &muic_irqs[i];
int virq = 0; unsigned int virq = 0;
virq = irq_create_mapping(max8997->irq_domain, muic_irq->irq); virq = irq_create_mapping(max8997->irq_domain, muic_irq->irq);
if (!virq) if (!virq) {
ret = -EINVAL;
goto err_irq; goto err_irq;
}
muic_irq->virq = virq; muic_irq->virq = virq;
ret = request_threaded_irq(virq, NULL,max8997_muic_irq_handler, ret = request_threaded_irq(virq, NULL, max8997_muic_irq_handler,
0, muic_irq->name, info); 0, muic_irq->name, info);
if (ret) { if (ret) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
@ -469,7 +471,8 @@ static int max8997_muic_probe(struct platform_device *pdev)
} }
/* External connector */ /* External connector */
info->edev = kzalloc(sizeof(struct extcon_dev), GFP_KERNEL); info->edev = devm_kzalloc(&pdev->dev, sizeof(struct extcon_dev),
GFP_KERNEL);
if (!info->edev) { if (!info->edev) {
dev_err(&pdev->dev, "failed to allocate memory for extcon\n"); dev_err(&pdev->dev, "failed to allocate memory for extcon\n");
ret = -ENOMEM; ret = -ENOMEM;
@ -480,7 +483,7 @@ static int max8997_muic_probe(struct platform_device *pdev)
ret = extcon_dev_register(info->edev, NULL); ret = extcon_dev_register(info->edev, NULL);
if (ret) { if (ret) {
dev_err(&pdev->dev, "failed to register extcon device\n"); dev_err(&pdev->dev, "failed to register extcon device\n");
goto err_extcon; goto err_irq;
} }
/* Initialize registers according to platform data */ /* Initialize registers according to platform data */
@ -498,13 +501,9 @@ static int max8997_muic_probe(struct platform_device *pdev)
return ret; return ret;
err_extcon:
kfree(info->edev);
err_irq: err_irq:
while (--i >= 0) while (--i >= 0)
free_irq(muic_irqs[i].virq, info); free_irq(muic_irqs[i].virq, info);
kfree(info);
err_kfree:
return ret; return ret;
} }
@ -519,9 +518,6 @@ static int max8997_muic_remove(struct platform_device *pdev)
extcon_dev_unregister(info->edev); extcon_dev_unregister(info->edev);
kfree(info->edev);
kfree(info);
return 0; return 0;
} }

View File

@ -23,7 +23,9 @@
#ifndef __LINUX_EXTCON_H__ #ifndef __LINUX_EXTCON_H__
#define __LINUX_EXTCON_H__ #define __LINUX_EXTCON_H__
#include <linux/device.h>
#include <linux/notifier.h> #include <linux/notifier.h>
#include <linux/sysfs.h>
#define SUPPORTED_CABLE_MAX 32 #define SUPPORTED_CABLE_MAX 32
#define CABLE_NAME_MAX 30 #define CABLE_NAME_MAX 30
@ -74,12 +76,12 @@ struct extcon_cable;
/** /**
* struct extcon_dev - An extcon device represents one external connector. * struct extcon_dev - An extcon device represents one external connector.
* @name The name of this extcon device. Parent device name is used * @name: The name of this extcon device. Parent device name is used
* if NULL. * if NULL.
* @supported_cable Array of supported cable names ending with NULL. * @supported_cable: Array of supported cable names ending with NULL.
* If supported_cable is NULL, cable name related APIs * If supported_cable is NULL, cable name related APIs
* are disabled. * are disabled.
* @mutually_exclusive Array of mutually exclusive set of cables that cannot * @mutually_exclusive: Array of mutually exclusive set of cables that cannot
* be attached simultaneously. The array should be * be attached simultaneously. The array should be
* ending with NULL or be NULL (no mutually exclusive * ending with NULL or be NULL (no mutually exclusive
* cables). For example, if it is { 0x7, 0x30, 0}, then, * cables). For example, if it is { 0x7, 0x30, 0}, then,
@ -87,21 +89,21 @@ struct extcon_cable;
* be attached simulataneously. {0x7, 0} is equivalent to * be attached simulataneously. {0x7, 0} is equivalent to
* {0x3, 0x6, 0x5, 0}. If it is {0xFFFFFFFF, 0}, there * {0x3, 0x6, 0x5, 0}. If it is {0xFFFFFFFF, 0}, there
* can be no simultaneous connections. * can be no simultaneous connections.
* @print_name An optional callback to override the method to print the * @print_name: An optional callback to override the method to print the
* name of the extcon device. * name of the extcon device.
* @print_state An optional callback to override the method to print the * @print_state: An optional callback to override the method to print the
* status of the extcon device. * status of the extcon device.
* @dev Device of this extcon. Do not provide at register-time. * @dev: Device of this extcon. Do not provide at register-time.
* @state Attach/detach state of this extcon. Do not provide at * @state: Attach/detach state of this extcon. Do not provide at
* register-time * register-time
* @nh Notifier for the state change events from this extcon * @nh: Notifier for the state change events from this extcon
* @entry To support list of extcon devices so that users can search * @entry: To support list of extcon devices so that users can search
* for extcon devices based on the extcon name. * for extcon devices based on the extcon name.
* @lock * @lock:
* @max_supported Internal value to store the number of cables. * @max_supported: Internal value to store the number of cables.
* @extcon_dev_type Device_type struct to provide attribute_groups * @extcon_dev_type: Device_type struct to provide attribute_groups
* customized for each extcon device. * customized for each extcon device.
* @cables Sysfs subdirectories. Each represents one cable. * @cables: Sysfs subdirectories. Each represents one cable.
* *
* In most cases, users only need to provide "User initializing data" of * In most cases, users only need to provide "User initializing data" of
* this struct when registering an extcon. In some exceptional cases, * this struct when registering an extcon. In some exceptional cases,
@ -137,12 +139,12 @@ struct extcon_dev {
/** /**
* struct extcon_cable - An internal data for each cable of extcon device. * struct extcon_cable - An internal data for each cable of extcon device.
* @edev The extcon device * @edev: The extcon device
* @cable_index Index of this cable in the edev * @cable_index: Index of this cable in the edev
* @attr_g Attribute group for the cable * @attr_g: Attribute group for the cable
* @attr_name "name" sysfs entry * @attr_name: "name" sysfs entry
* @attr_state "state" sysfs entry * @attr_state: "state" sysfs entry
* @attrs Array pointing to attr_name and attr_state for attr_g * @attrs: Array pointing to attr_name and attr_state for attr_g
*/ */
struct extcon_cable { struct extcon_cable {
struct extcon_dev *edev; struct extcon_dev *edev;
@ -158,11 +160,11 @@ struct extcon_cable {
/** /**
* struct extcon_specific_cable_nb - An internal data for * struct extcon_specific_cable_nb - An internal data for
* extcon_register_interest(). * extcon_register_interest().
* @internal_nb a notifier block bridging extcon notifier and cable notifier. * @internal_nb: a notifier block bridging extcon notifier and cable notifier.
* @user_nb user provided notifier block for events from a specific cable. * @user_nb: user provided notifier block for events from a specific cable.
* @cable_index the target cable. * @cable_index: the target cable.
* @edev the target extcon device. * @edev: the target extcon device.
* @previous_value the saved previous event value. * @previous_value: the saved previous event value.
*/ */
struct extcon_specific_cable_nb { struct extcon_specific_cable_nb {
struct notifier_block internal_nb; struct notifier_block internal_nb;