Skip to content

Commit 90cb220

Browse files
committed
Merge tag 'gpio-fixes-for-v6.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux
Pull gpio fixes from Bartosz Golaszewski: - update gpio-sim selftests to not fail now that we no longer allow rmdir() on configfs entries of active devices - remove leftover code from gpio-mxc * tag 'gpio-fixes-for-v6.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: selftests: gpio: gpio-sim: Fix missing chip disablements gpio: mxc: remove dead code after switch to DT-only
2 parents d3d90cc + f8524ac commit 90cb220

File tree

2 files changed

+26
-8
lines changed

2 files changed

+26
-8
lines changed

drivers/gpio/gpio-mxc.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,8 +490,7 @@ static int mxc_gpio_probe(struct platform_device *pdev)
490490
port->gc.request = mxc_gpio_request;
491491
port->gc.free = mxc_gpio_free;
492492
port->gc.to_irq = mxc_gpio_to_irq;
493-
port->gc.base = (pdev->id < 0) ? of_alias_get_id(np, "gpio") * 32 :
494-
pdev->id * 32;
493+
port->gc.base = of_alias_get_id(np, "gpio") * 32;
495494

496495
err = devm_gpiochip_add_data(&pdev->dev, &port->gc, port);
497496
if (err)

tools/testing/selftests/gpio/gpio-sim.sh

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,6 @@ remove_chip() {
4646
rmdir $CONFIGFS_DIR/$CHIP || fail "Unable to remove the chip"
4747
}
4848

49-
configfs_cleanup() {
50-
for CHIP in `ls $CONFIGFS_DIR/`; do
51-
remove_chip $CHIP
52-
done
53-
}
54-
5549
create_chip() {
5650
local CHIP=$1
5751

@@ -105,6 +99,13 @@ disable_chip() {
10599
echo 0 > $CONFIGFS_DIR/$CHIP/live || fail "Unable to disable the chip"
106100
}
107101

102+
configfs_cleanup() {
103+
for CHIP in `ls $CONFIGFS_DIR/`; do
104+
disable_chip $CHIP
105+
remove_chip $CHIP
106+
done
107+
}
108+
108109
configfs_chip_name() {
109110
local CHIP=$1
110111
local BANK=$2
@@ -181,6 +182,7 @@ create_chip chip
181182
create_bank chip bank
182183
enable_chip chip
183184
test -n `cat $CONFIGFS_DIR/chip/bank/chip_name` || fail "chip_name doesn't work"
185+
disable_chip chip
184186
remove_chip chip
185187

186188
echo "1.2. chip_name returns 'none' if the chip is still pending"
@@ -195,6 +197,7 @@ create_chip chip
195197
create_bank chip bank
196198
enable_chip chip
197199
test -n `cat $CONFIGFS_DIR/chip/dev_name` || fail "dev_name doesn't work"
200+
disable_chip chip
198201
remove_chip chip
199202

200203
echo "2. Creating and configuring simulated chips"
@@ -204,6 +207,7 @@ create_chip chip
204207
create_bank chip bank
205208
enable_chip chip
206209
test "`get_chip_num_lines chip bank`" = "1" || fail "default number of lines is not 1"
210+
disable_chip chip
207211
remove_chip chip
208212

209213
echo "2.2. Number of lines can be specified"
@@ -212,6 +216,7 @@ create_bank chip bank
212216
set_num_lines chip bank 16
213217
enable_chip chip
214218
test "`get_chip_num_lines chip bank`" = "16" || fail "number of lines is not 16"
219+
disable_chip chip
215220
remove_chip chip
216221

217222
echo "2.3. Label can be set"
@@ -220,13 +225,15 @@ create_bank chip bank
220225
set_label chip bank foobar
221226
enable_chip chip
222227
test "`get_chip_label chip bank`" = "foobar" || fail "label is incorrect"
228+
disable_chip chip
223229
remove_chip chip
224230

225231
echo "2.4. Label can be left empty"
226232
create_chip chip
227233
create_bank chip bank
228234
enable_chip chip
229235
test -z "`cat $CONFIGFS_DIR/chip/bank/label`" || fail "label is not empty"
236+
disable_chip chip
230237
remove_chip chip
231238

232239
echo "2.5. Line names can be configured"
@@ -238,6 +245,7 @@ set_line_name chip bank 2 bar
238245
enable_chip chip
239246
test "`get_line_name chip bank 0`" = "foo" || fail "line name is incorrect"
240247
test "`get_line_name chip bank 2`" = "bar" || fail "line name is incorrect"
248+
disable_chip chip
241249
remove_chip chip
242250

243251
echo "2.6. Line config can remain unused if offset is greater than number of lines"
@@ -248,6 +256,7 @@ set_line_name chip bank 5 foobar
248256
enable_chip chip
249257
test "`get_line_name chip bank 0`" = "" || fail "line name is incorrect"
250258
test "`get_line_name chip bank 1`" = "" || fail "line name is incorrect"
259+
disable_chip chip
251260
remove_chip chip
252261

253262
echo "2.7. Line configfs directory names are sanitized"
@@ -267,6 +276,7 @@ for CHIP in $CHIPS; do
267276
enable_chip $CHIP
268277
done
269278
for CHIP in $CHIPS; do
279+
disable_chip $CHIP
270280
remove_chip $CHIP
271281
done
272282

@@ -278,13 +288,15 @@ echo foobar > $CONFIGFS_DIR/chip/bank/label 2> /dev/null && \
278288
fail "Setting label of a live chip should fail"
279289
echo 8 > $CONFIGFS_DIR/chip/bank/num_lines 2> /dev/null && \
280290
fail "Setting number of lines of a live chip should fail"
291+
disable_chip chip
281292
remove_chip chip
282293

283294
echo "2.10. Can't create line items when chip is live"
284295
create_chip chip
285296
create_bank chip bank
286297
enable_chip chip
287298
mkdir $CONFIGFS_DIR/chip/bank/line0 2> /dev/null && fail "Creating line item should fail"
299+
disable_chip chip
288300
remove_chip chip
289301

290302
echo "2.11. Probe errors are propagated to user-space"
@@ -316,6 +328,7 @@ mkdir -p $CONFIGFS_DIR/chip/bank/line4/hog
316328
enable_chip chip
317329
$BASE_DIR/gpio-mockup-cdev -s 1 /dev/`configfs_chip_name chip bank` 4 2> /dev/null && \
318330
fail "Setting the value of a hogged line shouldn't succeed"
331+
disable_chip chip
319332
remove_chip chip
320333

321334
echo "3. Controlling simulated chips"
@@ -331,6 +344,7 @@ test "$?" = "1" || fail "pull set incorrectly"
331344
sysfs_set_pull chip bank 0 pull-down
332345
$BASE_DIR/gpio-mockup-cdev /dev/`configfs_chip_name chip bank` 1
333346
test "$?" = "0" || fail "pull set incorrectly"
347+
disable_chip chip
334348
remove_chip chip
335349

336350
echo "3.2. Pull can be read from sysfs"
@@ -344,6 +358,7 @@ SYSFS_PATH=/sys/devices/platform/$DEVNAME/$CHIPNAME/sim_gpio0/pull
344358
test `cat $SYSFS_PATH` = "pull-down" || fail "reading the pull failed"
345359
sysfs_set_pull chip bank 0 pull-up
346360
test `cat $SYSFS_PATH` = "pull-up" || fail "reading the pull failed"
361+
disable_chip chip
347362
remove_chip chip
348363

349364
echo "3.3. Incorrect input in sysfs is rejected"
@@ -355,6 +370,7 @@ DEVNAME=`configfs_dev_name chip`
355370
CHIPNAME=`configfs_chip_name chip bank`
356371
SYSFS_PATH="/sys/devices/platform/$DEVNAME/$CHIPNAME/sim_gpio0/pull"
357372
echo foobar > $SYSFS_PATH 2> /dev/null && fail "invalid input not detected"
373+
disable_chip chip
358374
remove_chip chip
359375

360376
echo "3.4. Can't write to value"
@@ -365,6 +381,7 @@ DEVNAME=`configfs_dev_name chip`
365381
CHIPNAME=`configfs_chip_name chip bank`
366382
SYSFS_PATH="/sys/devices/platform/$DEVNAME/$CHIPNAME/sim_gpio0/value"
367383
echo 1 > $SYSFS_PATH 2> /dev/null && fail "writing to 'value' succeeded unexpectedly"
384+
disable_chip chip
368385
remove_chip chip
369386

370387
echo "4. Simulated GPIO chips are functional"
@@ -382,6 +399,7 @@ $BASE_DIR/gpio-mockup-cdev -s 1 /dev/`configfs_chip_name chip bank` 0 &
382399
sleep 0.1 # FIXME Any better way?
383400
test `cat $SYSFS_PATH` = "1" || fail "incorrect value read from sysfs"
384401
kill $!
402+
disable_chip chip
385403
remove_chip chip
386404

387405
echo "4.2. Bias settings work correctly"
@@ -394,6 +412,7 @@ CHIPNAME=`configfs_chip_name chip bank`
394412
SYSFS_PATH="/sys/devices/platform/$DEVNAME/$CHIPNAME/sim_gpio0/value"
395413
$BASE_DIR/gpio-mockup-cdev -b pull-up /dev/`configfs_chip_name chip bank` 0
396414
test `cat $SYSFS_PATH` = "1" || fail "bias setting does not work"
415+
disable_chip chip
397416
remove_chip chip
398417

399418
echo "GPIO $MODULE test PASS"

0 commit comments

Comments
 (0)