Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 849c529f authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6:
  firewire: don't respond to broadcast write requests
  firewire: clean up fw_card reference counting
  firewire: clean up some includes
  firewire: remove unused struct members
  firewire: implement broadcast_channel CSR for 1394a compliance
  ieee1394: dump mmapped iso buffers in core files
  ieee1394: raw1394: Push the BKL down into the driver ioctls
  ieee1394: video1394: reorder module init, prepare BKL removal
  ieee1394: reduce log noise about config ROM CRC errors
parents b9d2252c a7ea6782
Loading
Loading
Loading
Loading
+21 −11
Original line number Diff line number Diff line
@@ -16,12 +16,15 @@
 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#include <linux/module.h>
#include <linux/errno.h>
#include <linux/completion.h>
#include <linux/crc-itu-t.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/errno.h>
#include <linux/kref.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/crc-itu-t.h>

#include "fw-transaction.h"
#include "fw-topology.h"
#include "fw-device.h"
@@ -396,14 +399,16 @@ fw_card_initialize(struct fw_card *card, const struct fw_card_driver *driver,
{
	static atomic_t index = ATOMIC_INIT(-1);

	atomic_set(&card->device_count, 0);
	card->index = atomic_inc_return(&index);
	card->driver = driver;
	card->device = device;
	card->current_tlabel = 0;
	card->tlabel_mask = 0;
	card->color = 0;
	card->broadcast_channel = BROADCAST_CHANNEL_INITIAL;

	kref_init(&card->kref);
	init_completion(&card->done);
	INIT_LIST_HEAD(&card->transaction_list);
	spin_lock_init(&card->lock);
	setup_timer(&card->flush_timer,
@@ -496,7 +501,6 @@ dummy_enable_phys_dma(struct fw_card *card,
}

static struct fw_card_driver dummy_driver = {
	.name            = "dummy",
	.enable          = dummy_enable,
	.update_phy_reg  = dummy_update_phy_reg,
	.set_config_rom  = dummy_set_config_rom,
@@ -506,6 +510,14 @@ static struct fw_card_driver dummy_driver = {
	.enable_phys_dma = dummy_enable_phys_dma,
};

void
fw_card_release(struct kref *kref)
{
	struct fw_card *card = container_of(kref, struct fw_card, kref);

	complete(&card->done);
}

void
fw_core_remove_card(struct fw_card *card)
{
@@ -521,12 +533,10 @@ fw_core_remove_card(struct fw_card *card)
	card->driver = &dummy_driver;

	fw_destroy_nodes(card);
	/*
	 * Wait for all device workqueue jobs to finish.  Otherwise the
	 * firewire-core module could be unloaded before the jobs ran.
	 */
	while (atomic_read(&card->device_count) > 0)
		msleep(100);

	/* Wait for all users, especially device workqueue jobs, to finish. */
	fw_card_put(card);
	wait_for_completion(&card->done);

	cancel_delayed_work_sync(&card->work);
	fw_flush_transactions(card);
+2 −3
Original line number Diff line number Diff line
@@ -168,7 +168,7 @@ static void fw_device_release(struct device *dev)
	fw_node_put(device->node);
	kfree(device->config_rom);
	kfree(device);
	atomic_dec(&card->device_count);
	fw_card_put(card);
}

int fw_device_enable_phys_dma(struct fw_device *device)
@@ -946,8 +946,7 @@ void fw_node_event(struct fw_card *card, struct fw_node *node, int event)
		 */
		device_initialize(&device->device);
		atomic_set(&device->state, FW_DEVICE_INITIALIZING);
		atomic_inc(&card->device_count);
		device->card = card;
		device->card = fw_card_get(card);
		device->node = fw_node_get(node);
		device->node_id = node->node_id;
		device->generation = card->generation;
+0 −1
Original line number Diff line number Diff line
@@ -62,7 +62,6 @@ struct fw_device {
	bool cmc;
	struct fw_card *card;
	struct device device;
	struct list_head link;
	struct list_head client_list;
	u32 *config_rom;
	size_t config_rom_length;
+0 −1
Original line number Diff line number Diff line
@@ -2292,7 +2292,6 @@ ohci_queue_iso(struct fw_iso_context *base,
}

static const struct fw_card_driver ohci_driver = {
	.name			= ohci_driver_name,
	.enable			= ohci_enable,
	.update_phy_reg		= ohci_update_phy_reg,
	.set_config_rom		= ohci_set_config_rom,
+23 −9
Original line number Diff line number Diff line
@@ -55,6 +55,9 @@
#define HEADER_GET_DATA_LENGTH(q)	(((q) >> 16) & 0xffff)
#define HEADER_GET_EXTENDED_TCODE(q)	(((q) >> 0) & 0xffff)

#define HEADER_DESTINATION_IS_BROADCAST(q) \
	(((q) & HEADER_DESTINATION(0x3f)) == HEADER_DESTINATION(0x3f))

#define PHY_CONFIG_GAP_COUNT(gap_count)	(((gap_count) << 16) | (1 << 22))
#define PHY_CONFIG_ROOT_ID(node_id)	((((node_id) & 0x3f) << 24) | (1 << 23))
#define PHY_IDENTIFIER(id)		((id) << 30)
@@ -624,12 +627,9 @@ allocate_request(struct fw_packet *p)
void
fw_send_response(struct fw_card *card, struct fw_request *request, int rcode)
{
	/*
	 * Broadcast packets are reported as ACK_COMPLETE, so this
	 * check is sufficient to ensure we don't send response to
	 * broadcast packets or posted writes.
	 */
	if (request->ack != ACK_PENDING) {
	/* unified transaction or broadcast transaction: don't respond */
	if (request->ack != ACK_PENDING ||
	    HEADER_DESTINATION_IS_BROADCAST(request->request_header[0])) {
		kfree(request);
		return;
	}
@@ -817,12 +817,13 @@ handle_registers(struct fw_card *card, struct fw_request *request,
	int reg = offset & ~CSR_REGISTER_BASE;
	unsigned long long bus_time;
	__be32 *data = payload;
	int rcode = RCODE_COMPLETE;

	switch (reg) {
	case CSR_CYCLE_TIME:
	case CSR_BUS_TIME:
		if (!TCODE_IS_READ_REQUEST(tcode) || length != 4) {
			fw_send_response(card, request, RCODE_TYPE_ERROR);
			rcode = RCODE_TYPE_ERROR;
			break;
		}

@@ -831,7 +832,17 @@ handle_registers(struct fw_card *card, struct fw_request *request,
			*data = cpu_to_be32(bus_time);
		else
			*data = cpu_to_be32(bus_time >> 25);
		fw_send_response(card, request, RCODE_COMPLETE);
		break;

	case CSR_BROADCAST_CHANNEL:
		if (tcode == TCODE_READ_QUADLET_REQUEST)
			*data = cpu_to_be32(card->broadcast_channel);
		else if (tcode == TCODE_WRITE_QUADLET_REQUEST)
			card->broadcast_channel =
			    (be32_to_cpu(*data) & BROADCAST_CHANNEL_VALID) |
			    BROADCAST_CHANNEL_INITIAL;
		else
			rcode = RCODE_TYPE_ERROR;
		break;

	case CSR_BUS_MANAGER_ID:
@@ -850,10 +861,13 @@ handle_registers(struct fw_card *card, struct fw_request *request,

	case CSR_BUSY_TIMEOUT:
		/* FIXME: Implement this. */

	default:
		fw_send_response(card, request, RCODE_ADDRESS_ERROR);
		rcode = RCODE_ADDRESS_ERROR;
		break;
	}

	fw_send_response(card, request, rcode);
}

static struct fw_address_handler registers = {
Loading