<commit_before>#!/bin/bash
set -x
PATH=$PATH:/sbin
# invalidate existing device (so that scan will look for new one)
BLUEDEVICE=`lspci -d 1be7:c100 | sed -e "s/ .*//"`
if [ "$BLUEDEVICE" != "" ]; then
    sh -c "echo 1 >/sys/bus/pci/devices/0000:$BLUEDEVICE/remove"
fi
BLUEDEVICE=`lspci -d 1be7:b100 | sed -e "s/ .*//"`
if [ "$BLUEDEVICE" != "" ]; then
    sh -c "echo 1 >/sys/bus/pci/devices/0000:$BLUEDEVICE/remove"
fi
#sh -c "echo 1 >/sys/bus/pci/devices/0000:01:00.0/remove"
# remove existing driver, since there is some bug in the 'remove'
# function, causing the driver to become unmapped although
# it is still registered (and causing a segv on the probe call)
sleep 1
(lsmod | grep -q pcieportal) && rmmod pcieportal
(lsmod | grep -q bluenoc) && rmmod pcieportal
sleep 1
sh -c "echo 1 >/sys/bus/pci/rescan"
sleep 1
#lspci -vv -d 1be7:c100<commit_msg>refactored check for bluespec or pcieportal devices<commit_after>#!/bin/bash
set -x
PATH=$PATH:/sbin
# invalidate existing device (so that scan will look for new one)
for devid in 1be7:c100 1be7:b100; do
    BLUEDEVICE=`lspci -d $devid | sed -e "s/ .*//"`
    if [ "$BLUEDEVICE" != "" ]; then
        sh -c "echo 1 >/sys/bus/pci/devices/0000:$BLUEDEVICE/remove"
    fi
done
#sh -c "echo 1 >/sys/bus/pci/devices/0000:01:00.0/remove"
# remove existing driver, since there is some bug in the 'remove'
# function, causing the driver to become unmapped although
# it is still registered (and causing a segv on the probe call)
sleep 1
(lsmod | grep -q pcieportal) && rmmod pcieportal
(lsmod | grep -q bluenoc) && rmmod pcieportal
sleep 1
sh -c "echo 1 >/sys/bus/pci/rescan"
sleep 1
#lspci -vv -d 1be7:c100
{'fraction_non_alphanumeric': 0.14182257091128544, 'fraction_numerical': 0.044055522027761015, 'mean_word_length': 3.657303370786517, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '45488', 'n_tokens_mistral': 682, 'n_tokens_neox': 646, 'n_words': 213}