changed Makefile and profiles, added patches for kernel 2.6.24
[openwrt/svn-archive/archive.git] / target / linux / s3c24xx / patches-2.6.26 / 0183-fix-pcf50633-use-pcf-not-data-in-probe-for-context.p.patch
1 From 22bdcec1c140689c6fce71ca04d7afcaa44d52f0 Mon Sep 17 00:00:00 2001
2 From: Andy Green <andy@openmoko.com>
3 Date: Fri, 25 Jul 2008 23:06:15 +0100
4 Subject: [PATCH] fix-pcf50633-use-pcf-not-data-in-probe-for-context.patch
5
6 Everywhere in the sources except the probe function the context
7 pointer is called "pcf"... in there it's called "data" for some
8 reason. This stops confusion by changing it to be "pcf" in there
9 as well.
10
11 Signed-off-by: Andy Green <andy@openmoko.com>
12 ---
13 drivers/i2c/chips/pcf50633.c | 117 +++++++++++++++++++++--------------------
14 1 files changed, 60 insertions(+), 57 deletions(-)
15
16 diff --git a/drivers/i2c/chips/pcf50633.c b/drivers/i2c/chips/pcf50633.c
17 index 850bf93..4cb333c 100644
18 --- a/drivers/i2c/chips/pcf50633.c
19 +++ b/drivers/i2c/chips/pcf50633.c
20 @@ -2063,7 +2063,7 @@ static void populate_sysfs_group(struct pcf50633_data *pcf)
21 static int pcf50633_detect(struct i2c_adapter *adapter, int address, int kind)
22 {
23 struct i2c_client *new_client;
24 - struct pcf50633_data *data;
25 + struct pcf50633_data *pcf;
26 int err = 0;
27 int irq;
28
29 @@ -2086,23 +2086,24 @@ static int pcf50633_detect(struct i2c_adapter *adapter, int address, int kind)
30 return -EBUSY;
31 }
32
33 - if (!(data = kzalloc(sizeof(*data), GFP_KERNEL)))
34 + pcf = kzalloc(sizeof(*pcf), GFP_KERNEL);
35 + if (!pcf)
36 return -ENOMEM;
37
38 - mutex_init(&data->lock);
39 - mutex_init(&data->working_lock);
40 - mutex_init(&data->working_lock_nobat);
41 - mutex_init(&data->working_lock_usb_curlimit);
42 - INIT_WORK(&data->work, pcf50633_work);
43 - INIT_WORK(&data->work_nobat, pcf50633_work_nobat);
44 - INIT_WORK(&data->work_usb_curlimit, pcf50633_work_usbcurlim);
45 - data->irq = irq;
46 - data->working = 0;
47 - data->onkey_seconds = -1;
48 - data->pdata = pcf50633_pdev->dev.platform_data;
49 -
50 - new_client = &data->client;
51 - i2c_set_clientdata(new_client, data);
52 + mutex_init(&pcf->lock);
53 + mutex_init(&pcf->working_lock);
54 + mutex_init(&pcf->working_lock_nobat);
55 + mutex_init(&pcf->working_lock_usb_curlimit);
56 + INIT_WORK(&pcf->work, pcf50633_work);
57 + INIT_WORK(&pcf->work_nobat, pcf50633_work_nobat);
58 + INIT_WORK(&pcf->work_usb_curlimit, pcf50633_work_usbcurlim);
59 + pcf->irq = irq;
60 + pcf->working = 0;
61 + pcf->onkey_seconds = -1;
62 + pcf->pdata = pcf50633_pdev->dev.platform_data;
63 +
64 + new_client = &pcf->client;
65 + i2c_set_clientdata(new_client, pcf);
66 new_client->addr = address;
67 new_client->adapter = adapter;
68 new_client->driver = &pcf50633_driver;
69 @@ -2118,11 +2119,11 @@ static int pcf50633_detect(struct i2c_adapter *adapter, int address, int kind)
70 goto exit_free;
71 }
72
73 - pcf50633_global = data;
74 + pcf50633_global = pcf;
75
76 - init_resume_dependency_list(&data->resume_dependency);
77 + init_resume_dependency_list(&pcf->resume_dependency);
78
79 - populate_sysfs_group(data);
80 + populate_sysfs_group(pcf);
81
82 err = sysfs_create_group(&new_client->dev.kobj, &pcf_attr_group);
83 if (err) {
84 @@ -2135,32 +2136,35 @@ static int pcf50633_detect(struct i2c_adapter *adapter, int address, int kind)
85 /* register power off handler with core power management */
86 pm_power_off = &pcf50633_go_standby;
87
88 - data->input_dev = input_allocate_device();
89 - if (!data->input_dev)
90 + pcf->input_dev = input_allocate_device();
91 + if (!pcf->input_dev)
92 goto exit_sysfs;
93
94 - data->input_dev->name = "GTA02 PMU events";
95 - data->input_dev->phys = "FIXME";
96 - data->input_dev->id.bustype = BUS_I2C;
97 + pcf->input_dev->name = "GTA02 PMU events";
98 + pcf->input_dev->phys = "FIXME";
99 + pcf->input_dev->id.bustype = BUS_I2C;
100 + pcf->input_dev->cdev.dev = &new_client->dev;
101
102 - data->input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_PWR);
103 - set_bit(KEY_POWER, data->input_dev->keybit);
104 - set_bit(KEY_POWER2, data->input_dev->keybit);
105 - set_bit(KEY_BATTERY, data->input_dev->keybit);
106 + pcf->input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_PWR);
107 + set_bit(KEY_POWER, pcf->input_dev->keybit);
108 + set_bit(KEY_POWER2, pcf->input_dev->keybit);
109 + set_bit(KEY_BATTERY, pcf->input_dev->keybit);
110
111 - err = input_register_device(data->input_dev);
112 + err = input_register_device(pcf->input_dev);
113 if (err)
114 goto exit_sysfs;
115
116 /* configure interrupt mask */
117 - reg_write(data, PCF50633_REG_INT1M, 0x00); /* we want SECOND to kick */
118 - reg_write(data, PCF50633_REG_INT2M, 0x00);
119 - reg_write(data, PCF50633_REG_INT3M, 0x00);
120 - reg_write(data, PCF50633_REG_INT4M, 0x00);
121 - reg_write(data, PCF50633_REG_INT5M, 0x00);
122 +
123 + /* we want SECOND to kick for the coldplug initialisation */
124 + reg_write(pcf, PCF50633_REG_INT1M, 0x00);
125 + reg_write(pcf, PCF50633_REG_INT2M, 0x00);
126 + reg_write(pcf, PCF50633_REG_INT3M, 0x00);
127 + reg_write(pcf, PCF50633_REG_INT4M, 0x00);
128 + reg_write(pcf, PCF50633_REG_INT5M, 0x00);
129
130 err = request_irq(irq, pcf50633_irq, IRQF_TRIGGER_FALLING,
131 - "pcf50633", data);
132 + "pcf50633", pcf);
133 if (err < 0)
134 goto exit_input;
135
136 @@ -2168,59 +2172,58 @@ static int pcf50633_detect(struct i2c_adapter *adapter, int address, int kind)
137 dev_err(&new_client->dev, "IRQ %u cannot be enabled as wake-up"
138 "source in this hardware revision!", irq);
139
140 - if (data->pdata->used_features & PCF50633_FEAT_RTC) {
141 - data->rtc = rtc_device_register("pcf50633", &new_client->dev,
142 + if (pcf->pdata->used_features & PCF50633_FEAT_RTC) {
143 + pcf->rtc = rtc_device_register("pcf50633", &new_client->dev,
144 &pcf50633_rtc_ops, THIS_MODULE);
145 - if (IS_ERR(data->rtc)) {
146 - err = PTR_ERR(data->rtc);
147 + if (IS_ERR(pcf->rtc)) {
148 + err = PTR_ERR(pcf->rtc);
149 goto exit_irq;
150 }
151 }
152
153 - if (data->pdata->used_features & PCF50633_FEAT_PWM_BL) {
154 - data->backlight = backlight_device_register("pcf50633-bl",
155 + if (pcf->pdata->used_features & PCF50633_FEAT_PWM_BL) {
156 + pcf->backlight = backlight_device_register("pcf50633-bl",
157 &new_client->dev,
158 - data,
159 + pcf,
160 &pcf50633bl_ops);
161 - if (!data->backlight)
162 + if (!pcf->backlight)
163 goto exit_rtc;
164 /* FIXME: are we sure we want default == off? */
165 - data->backlight->props.max_brightness = 0x3f;
166 - data->backlight->props.power = FB_BLANK_UNBLANK;
167 - data->backlight->props.fb_blank = FB_BLANK_UNBLANK;
168 - data->backlight->props.brightness =
169 - data->backlight->props.max_brightness;
170 - backlight_update_status(data->backlight);
171 + pcf->backlight->props.max_brightness = 0x3f;
172 + pcf->backlight->props.power = FB_BLANK_UNBLANK;
173 + pcf->backlight->props.fb_blank = FB_BLANK_UNBLANK;
174 + pcf->backlight->props.brightness =
175 + pcf->backlight->props.max_brightness;
176 + backlight_update_status(pcf->backlight);
177 }
178
179 - apm_get_power_status = pcf50633_get_power_status;
180 - data->probe_completed = 1;
181 + pcf->probe_completed = 1;
182
183 - if (data->pdata->flag_use_apm_emulation)
184 + if (pcf->pdata->flag_use_apm_emulation)
185 apm_get_power_status = pcf50633_get_power_status;
186
187 /* if platform was interested, give him a chance to register
188 * platform devices that switch power with us as the parent
189 * at registration time -- ensures suspend / resume ordering
190 */
191 - if (data->pdata->attach_child_devices)
192 - (data->pdata->attach_child_devices)(&new_client->dev);
193 + if (pcf->pdata->attach_child_devices)
194 + (pcf->pdata->attach_child_devices)(&new_client->dev);
195
196 return 0;
197 exit_rtc:
198 - if (data->pdata->used_features & PCF50633_FEAT_RTC)
199 + if (pcf->pdata->used_features & PCF50633_FEAT_RTC)
200 rtc_device_unregister(pcf50633_global->rtc);
201 exit_irq:
202 free_irq(pcf50633_global->irq, pcf50633_global);
203 exit_input:
204 - input_unregister_device(data->input_dev);
205 + input_unregister_device(pcf->input_dev);
206 exit_sysfs:
207 pm_power_off = NULL;
208 sysfs_remove_group(&new_client->dev.kobj, &pcf_attr_group);
209 exit_detach:
210 i2c_detach_client(new_client);
211 exit_free:
212 - kfree(data);
213 + kfree(pcf);
214 pcf50633_global = NULL;
215 return err;
216 }
217 --
218 1.5.6.3
219